Pandas DataFrame error when using to_csv

afzi
New Contributor II

Hi Everyone, 

I would like to a Pandas Dataframe to /dbfs/FileStore/ using to_csv method.

Usually it would just write the Dataframe to the path described but It has been giving me "FileNotFoundError: [Errno 2] No such file or directory: '/dbfs/FileStore/test.csv".

I have tried

df.to_csv("/dbfs/FileStore/test.csv", header= None, index= None)
 
df.to_csv("dbfs/FileStore/test.csv", header=None, index=None)
 
df.to_csv("dbfs:/FileStore/test.csv", header=None, index=None)
 
df.to_csv("/FileStore/test.csv", header=None, index=None)
 
df.to_csv("FileStore/test.csv", header=None, index=None)

But all give out the same error.

using dbutils i see that the folder are present.

dbutils.fs.ls("dbfs:/FileStore")
 
Out[32]: [FileInfo(path='dbfs:/FileStore/tables/', name='tables/', size=0, modificationTime=0)]

I am new here and i tried searching the problem for a long time but I can't find a solution. Please help.

Avinash_94
Databricks Employee
Databricks Employee

f = open("/dbfs/mnt/blob/myNames.txt", "r")