This is my code and I keep getting this error and I am not sure how to fix it. I am probably calling the method wrong. The problem is to: Use Series method describe to calculate the descriptive statistics for the categorical data (text) columns from the dataset.
my code:
import pandas as pd
df = pd.read_csv('Housing.csv', index_col = 0)
print('Description: ', df.describe())
print('Series description: ', df.Series.describe())
print('Histograms: ', df.hist(figsize = (8, 8)))
print('Series description: ', df.series.describe())
The dataframe includes columns, each of which are series, but the dataframe itself is not a series. Looks like you want to describe the entire df, then describe particular columns. If so, pick each individual column to describe, because those columns are series. See this toy example:
row1list = ['$500 -', 'www']
row2list = ['$4.00 -', 'xyz']
df = pd.DataFrame([row1list, row2list],
columns=['Price', 'abc'])
print(df.describe)
# <bound method NDFrame.describe of Price abc
# 0 $500 - www
# 1 $4.00 - xyz>
print(df['Price'].describe())
# count 2
# unique 2
# top $4.00 -
# freq 1
# Name: Price, dtype: object
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.