Closing file after using to_csv()

后端 未结 3 835
猫巷女王i
猫巷女王i 2020-12-19 19:37

I am new to python and so far I am loving the ipython notebook for learning. Am I using the to_csv() function to write out a pandas dataframe out to a file. I wanted to o

3条回答
  •  既然无缘
    2020-12-19 20:11

    @rpattiso thank you.

    try opening and closing the file yourself:

    outfile = open(path+'filename.csv', 'wb')
    df.to_csv(outfile)
    outfile.close()     
    

提交回复
热议问题