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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -