pandas.core.window.Rolling.skew

Unbiased rolling skewness.

**kwargs Keyword arguments to be passed into func.

return

Series or DataFrame Return type is determined by the caller.

Examples

Unbiased rolling skewness.
import pandas as pd
from numba import njit


@njit
def series_rolling_skew():
    series = pd.Series([4, 3, 5, 2, 6])  # Series of 4, 3, 5, 2, 6
    out_series = series.rolling(3).skew()

    return out_series  # Expect series of NaN, NaN, 0.000000, 0.935220, -1.293343


print(series_rolling_skew())
$ python ./series/rolling/series_rolling_skew.py
0         NaN
1         NaN
2    0.000000
3    0.935220
4   -1.293343
dtype: float64
Unbiased rolling skewness.
import pandas as pd
from numba import njit


@njit
def df_rolling_skew():
    df = pd.DataFrame({'A': [4, 3, 5, 2, 6], 'B': [-4, -3, -5, -2, -6]})
    out_df = df.rolling(3).skew()

    # Expect DataFrame of
    # {'A': [NaN, NaN, 0.000000, 0.935220, -1.293343],
    #  'B': [NaN, NaN, 0.000000, -0.935220, 1.293343]}
    return out_df


print(df_rolling_skew())
$ python ./dataframe/rolling/dataframe_rolling_skew.py
          A         B
0       NaN       NaN
1       NaN       NaN
2  0.000000  0.000000
3  0.935220 -0.935220
4 -1.293343  1.293343

See also

Series.rolling

Calling object with a Series.

DataFrame.rolling

Calling object with a DataFrame.

Series.skew

Similar method for Series.

DataFrame.skew

Similar method for DataFrame.