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

How do you read files from the DBFS with OS and Pandas Python libraries?

MattPython
New Contributor

I created translations for decoded values and want to save the dictionary object the DBFS for mapping. However, I am unable to access the DBFS without using dbutils or PySpark library.

Is there a way to access the DBFS with OS and Pandas Python libraries? At work, we can directly use the same path as the PySpark functions to write/ read from the DBFS without issue.

  1. Confirm files exist within DBFSimage.png
  2. Confirm ability to read file with PySparkimage
  3. Error 1 - recommends using "/dbfs" instead of "dbfs:"image
  4. Updated "/dbfs" - error persistsimage
  5. Removed DBFS entirely:image
  6. and one last shot....image

Thank you!

4 REPLIES 4

Chaitanya_Raju
Honored Contributor

Hi @Matthew LIbonatiโ€‹ ,

Can you please check again, I tried in the exact same way and initially faced the error as mentioned in point 3, then changed it to as mentioned in point 4, can able to see the data without any issues.

Happy Learning!!

Anonymous
Not applicable

Hi @Matthew LIbonatiโ€‹ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 

Cheers!

Johny
New Contributor III

Hi @Vidula Khannaโ€‹ ,

I am having the same issue (using Community Edition). I am aware that in CE, DBFS is not mounted to /dbfs root directory. Is this the cause? If so, that is the alternative?

Thank you

User16789202230
New Contributor II
New Contributor II
db_path = 'file:///Workspace/Users/l<xxxxx>@databricks.com/TITANIC_DEMO/tested.csv'
df = spark.read.csv(db_path, header = "True", inferSchema="True")
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.