A(csv file) record stock price which crawl from a stock-website everyday.
Stock_num Stock_name 20201201
0001 appl 201.3
0002 goog 1001.5
B(csv file) newest data crawl from same stock-website
Stock_num Stock_name 20201202
0001 appl 208.3
0002 goog 999.8
I want to use pandas to write B into A in below format(without read A).
Stock_num Stock_name 20201201 20201202
0001 appl 201.3 208.3
0002 goog 1001.5 999.8
I had try below:
B.to_csv('A.csv',index=False,mode='a', encoding='utf_8_sig')
But what I got is:
Stock_num Stock_name 20201201
0001 appl 201.3
0002 goog 1001.5
Stock_num Stock_name 20201202
0001 appl 208.3
0002 goog 999.8
I know I can read A.csv and concat with b.csv then output. But is there a way I can write B.csv into A.csv without read A.csv?