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.
Showing results for 
Search instead for 
Did you mean: 

Read file from dbfs with pd.read_csv() using databricks-connect

New Contributor III

Hello all,

As described in the title, here's my problem:

1. I'm using databricks-connect in order to send jobs to a databricks cluster

2. The "local" environment is an AWS EC2

3. I want to read a CSV file that is in DBFS (databricks) with

. Reason for that is that it's too big to do
and then
(crashes everytime).

4. When I run

I get a
because it points to the local S3 buckets rather than to dbfs. Is there a way to do what I want to do (e.g. change where pandas looks for files with some options)?

Thanks a lot in advance!


Accepted Solutions

Not applicable


After some research, I have found out that the pandas API reads only local files. This means that even if a read_csv command works in the Databricks Notebook environment, it will not work when using databricks-connect (pandas reads locally from within the notebook environment).

A work around is to use the pyspark'csv') API to read the remote files and append a ".toPandas()" at the end so that we get a pandas dataframe.

df_pandas ='csv').options(header='true').load('path/in/the/remote/dbfs/filesystem/').toPandas()

View solution in original post


Community Manager
Community Manager

Hi @ hamzatazib96 ! My name is Kaniz, and I'm a technical moderator here. Great to meet you, and thanks for your question! Let's see if your peers on the Forum have an answer to your questions first. Or else I will follow up shortly with a response.



what happens if you change it to below ?


Trying it with pd.read_excel does not help.

New Contributor II

I am having a similar issue:

  • I am running databricks-connect from within a docker container
  • I have a .xls file stored in Azure File storage, which is mounted to dbfs
  • I would like to read this excel file with

Has a solution been found for this?

Hi @venter2021, Did you try this?


I've tried, which doesn't work.

Hi @Yuanyue Liu​ , Which DBR version are you using?

Hi Fatma,

Thanks for asking.

I've tried 10.1 ML (includes Apache Spark 3.2.0, Scala 2.12) and 9.1 LTS (Scala 2.12, Spark 3.1.2) . Both of them don't work.

However, it works while I read it via spark. And I used display("dbfs:/FileStore/tables/")) to test it, my file path(dbfs:/FileStore/tables/POS_CASH_balance.csv) exists. So I don't think it is the problem of the path or my code of pandas. I personally guess that the free version didn't support reading csv/files from dbfs via pandas directly, isn't it?

Here is the change of my code, and the change works


Hope my experience could help others.


New Contributor II

DataBricks community edition 10.4 LTS ML (Apache Spark 3.2.1, Scala 2.12) has the same problem with pd.read_csv.

The statement replaces the original column names with (_c0, _c1,…), unless .option("header", true") is used.

The following forms should work:

path = 'dbfs:/FileStore/tables/POS_CASH_balance.csv'
.option("header", "true")
.option("header", "true")

Not applicable

Hi @Kaniz Fatma​ ,

I am having similar issues when using databricks-connect with Azure. I am not able to read data that is already mounted to dbfs (from a datalake gen2). The data is readable within the Azure Databricks Notebook environment but not from databricks-connect.

Hi @Arturo Amador​ , Please mention your DBR version.

Not applicable



9.1 LTS (includes Apache Spark 3.1.2, Scala 2.12)

Not applicable

@Kaniz Fatma​ ,

All tests in databricks-connect pass. I am also able to run the examples provided in the documentation (which do not read data from dbfs)

Hi @Arturo Amador​ , Would you like to share the changes you made in order to get the solution?

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!