准备把df文件按条件写入csv2的,但是写出来是空文件。所以我就按以下代码打印了一下发现只有字段,没有记录。哪位老兄遇到过呢?还望指教一二import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.tools as tls
import plotly.graph_objs as go
import json
import csv
from collections import defaultdict
tls.set_credentials_file(username='**', api_key='**')
f1 = open('E://ss.csv','r')
df = pd.read_csv(f1,dtype = {'***':str})
wf=open('csv2.csv','w')
write = csv.writer(wf)
for row in df:
print(row)
# if row[0] == '6':
# write.writerow(row)
f1.close()
添加回答
举报
0/150
提交
取消