i'm trying to calculteskewness and kurtosis for different fields. I want to get in the end table with each field name. the kurtosis and the skewness. for that I have written the next code:
for i in data_dis.columns:
print('skewness',i,':',i.skew())
print('Kurtosis',i,':',i.kurtosis())
AttributeError: 'str' object has no attribute 'skew'
I am 100% sure that there is no string in my database as you can see from the info:
data_dis.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1412 entries, 0 to 1411
Data columns (total 13 columns):
HR90 1412 non-null float64
HC90 1412 non-null float64
PO90 1412 non-null int64
RD90 1412 non-null float64
PS90 1412 non-null float64
UE90 1412 non-null float64
DV90 1412 non-null float64
MA90 1412 non-null float64
POL90 1412 non-null float64
DNL90 1412 non-null float64
BLK90 1412 non-null float64
GI89 1412 non-null float64
FH90 1412 non-null float64
I saw that skew works here: http://www.christianherta.de/lehre/dataScience/exploratory/intro-explorative-data-analysis.php
My end goal is to create a table with the skewness and kurtosis data for each field.
You don't need a for loop, you can just calculate skewness and kurtosis for each numerical column using the dataframe methods:
data_dis.skew()
data_dis.kurtosis()
They both return a Pandas Series, with indexes column names and as values the column skewness and column kurtosis respectively.