Reputation: 4546
I'm trying to use pandas.DataFrame.to_csv
to export a DataFrame
to a .csv
file, however after running the following code there's no output:
collist = sve2_all.columns
path_d = 'C:\\Users\\Desktop\\From EPD'
sve2_all.to_csv('sve2_all', path = path_d, columns = collist)
Upvotes: 1
Views: 9515
Reputation: 393873
I think what you are doing won't work as the path is not being used to set the destination path and resulting csv
This should work:
import os
path_d = 'C:\\Users\\Desktop\\From EPD'
sve2_all.to_csv(os.path.join(path_d, 'sve2_all.csv'))
Also, you are passing a string as the first parameter to to_csv
which is probably confusing it also as it should be a fully qualified path or buffer for path_or_buf
parameter.
Upvotes: 4