我使用以下代码写入平面文件
code = np.unique(from_csv['code'])
date_of_trade = np.unique(from_csv['date_of_trade'])
columns = ['code','max_csv_value','min_csv_value','volume_csv_value','mean_csv_value','date_of_trade']
df = pd.DataFrame(columns=columns)
df.loc[len(df)]=[date_of_trade,code,max_csv_value,min_csv_value,volume_csv_value,mean_csv_value]
with open("D:/file.csv", 'a') as f:
df.to_csv(f, header=False,index=False)
该文件包含代码周围的额外括号和平面文件中的date_of_trade
['2015-12-23'] ['1AL']
我该如何避免?