Python数据分析——series和DataFrame转化

一、series转化成dataframe

df_expenditure_mean = df.groupby(['Gender', 'name'], as_index=False)['income'].mean()

df_expenditure_mean = pd.DataFrame(df_expenditure_mean)#转化成dataframe格式

df_expenditure_mean.rename(columns={'income':'收入均值'}, inplace = True)

二、dataframe转化成series

你可能感兴趣的:(数据分析开始入门)