立即学习:https://edu.csdn.net/course/play/26990/361126?utm_source=blogtoedu
数据堆叠
一、纵向
1.函数直接使用
sheet_name=workboook.sheet_names()
order1=pd.read_excel("meal_order_detail.xlsx",sheet_name="meal_order_detail1")
order2=pd.read_excel("meal_order_detail.xlsx",sheet_name="meal_order_detail2")
order3=pd.read_excel("meal_order_detail.xlsx",sheet_name="meal_order_detail3")
order=pd.concat([order1,order2,order3],axis=0,ignore_index=True)
2. 创建一个空白dataframebasic=pd.DataFrame()
for i in sheet_name:
basic_i=pd.read_excel("meal_order_detail.xlsx",sheet_name=i)
basic=pd.concat([basic,basic_i],axis=0,ignore_index=True)
二、横向
df2=pd.merge(left=df,right=df1,how='inner',left_on='user_id',right_on='user_id')