python - How do I close a csv file created with pandas (pd.to_csv)? -
i first create file (appending mode)
db.to_csv(db, mode='a', header=false, sep='\t')
then try open it:
rdb=pd.read_table(db,sep="\t",header=true,parse_dates=true)
and next, python crashes,probably because file open, not it?
i have tried: db.close()
not work
i'm late answer here, else having problem, found answer here:
closing file after using to_csv()
you can pass to_csv file object instead of path, , close yourself, this:
outfile = open(path+'filename.csv', 'wb') df.to_csv(outfile) outfile.close()
Comments
Post a Comment