Hi: I am trying to use the Pandas
DataFrame.to_csv
method to save a dataframe
to a csv
file:
filename = './dir/name.csv'
df.to_csv(filename)
However I am getting the error:
IOError: [Errno 2] No such file or directory: './dir/name.csv'
Shouldn't the to_csv
method be able to create the file if it doesn't exist? This is what I am intending for it to do.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…