- API reference
- DataFrame
- pandas.DataF...
pandas.DataFrame.skew#
- DataFrame.skew(axis=0,skipna=True,numeric_only=False,**kwargs)[source]#
Return unbiased skew over requested axis.
Normalized by N-1.
- Parameters:
- axis{index (0), columns (1)}
Axis for the function to be applied on.ForSeries this parameter is unused and defaults to 0.
For DataFrames, specifying
axis=None
will apply the aggregationacross both axes.Added in version 2.0.0.
- skipnabool, default True
Exclude NA/null values when computing the result.
- numeric_onlybool, default False
Include only float, int, boolean columns. Not implemented for Series.
- **kwargs
Additional keyword arguments to be passed to the function.
- Returns:
- Series or scalar
Examples
>>>s=pd.Series([1,2,3])>>>s.skew()0.0
With a DataFrame
>>>df=pd.DataFrame({'a':[1,2,3],'b':[2,3,4],'c':[1,3,5]},...index=['tiger','zebra','cow'])>>>df a b ctiger 1 2 1zebra 2 3 3cow 3 4 5>>>df.skew()a 0.0b 0.0c 0.0dtype: float64
Using axis=1
>>>df.skew(axis=1)tiger 1.732051zebra -1.732051cow 0.000000dtype: float64
In this case,numeric_only should be set toTrue to avoidgetting an error.
>>>df=pd.DataFrame({'a':[1,2,3],'b':['T','Z','X']},...index=['tiger','zebra','cow'])>>>df.skew(numeric_only=True)a 0.0dtype: float64
On this page