蟒蛇。合并来自不同pd表的列

时间:2017-05-29 15:38:54

标签: python

有两个熊猫表:生产和销售,其中包含列'日期''卷'和别的。我需要一个单独的表格,其中只包含列'日期'批量生产'批量销售'。

enter image description here

1 个答案:

答案 0 :(得分:0)

import pandas as pd

column = ['Sales_vol'];

new_df = pd.DataFrame(data=df1['Sales_volume'], index = pd.to_datetime[df1['Date'], column = column);
new_df.insert(loc=1,column='Production_vol',value=df2['Production_volume']);

希望这有帮助。