Pandas是Python数据分析的核心工具。
数据透视
pivot = df.pivot_table(
values='sales',
index='month',
columns='category',
aggfunc='sum'
)合并数据
result = pd.merge(df1, df2, on='key', how='left')
combined = pd.concat([df1, df2], axis=0)时间序列
df['date'] = pd.to_datetime(df['date'])
monthly = df.resample('M').mean()
评论 (0)
暂无评论,来发表第一条评论吧!
发表评论