print(df2) test_data = pd.pivot(data=df2 # 待转换df , index=['main_customer_code1','product_code1'] # df交叉后行 , columns='data_date1' # df交叉后的列 , values='today_amount1' # df交叉后数据(不发生聚合) ) test_data.reset_index(inplace=True) print(test_data)
标签:index,df,print,转列,panas,test,data From: https://www.cnblogs.com/wutanghua/p/18010740