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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -