cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Error as no such file when reading CSV file using pandas

klllmmm
New Contributor II

I'm trying to read a CSV file saved in data using pandas read_csv function. But it gives No such file error.

%fs
ls /FileStore/tables/
 
df= pd.read_csv('/dbfs/FileStore/tables/CREDIT_1.CSV')
 
 
df= pd.read_csv('/dbfs:/FileStore/tables/CREDIT_1.CSV')
 
 
df= pd.read_csv('/FileStore/tables/CREDIT_1.CSV')

Can someone pls help with this?

image

3 REPLIES 3

-werners-
Esteemed Contributor III

I see you use pandas to read from dbfs.

But pandas will only read from local files,

see this topic also. It is about databricks-connect but the same principles apply.

So what you should do is first read the file using spark.read.csv and then converting the spark df to a pandas df.

Anonymous
Not applicable

Hi @Kelum Perera​ following - up did you get a chance to check @Werner Stinckens​ previous comments or do you need any further help on this?

klllmmm
New Contributor II

Thanks to @Werner Stinckens​ for the answer.

I understood that I have to use spark to read data from clusters.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.