Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import pandas as pd
- f1 = pd.read_csv(
- 'file1.csv',
- header=0,
- names=['date','ringo','mikan','banana'])
- f2 = pd.read_csv(
- 'file2.csv',
- header=0,
- names=['date','chicken','beef','pork'])
- f3 = f1.merge(f2, how='outer').sort_values(by='date')
- f3.to_csv(
- 'file3.csv',
- header=['','りんご','みかん','バナナ','鶏肉','牛肉','豚肉'],
- index=None,
- float_format='%.0f',
- na_rep='#N/A')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement