cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group