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

Py Spark Pandas Code diff

Krishscientist
New Contributor III

Hi Can you help me why Pandas code not working..but Pyspark is working..

import pandas as pd

pdf = pd.read_csv('/FileStore/tables/new.csv',sep=',')

Error : No such file exists...

below is worked..

df = spark.read.csv("/FileStore/tables/new.csv", sep=",", header='True')

1 ACCEPTED SOLUTION

Accepted Solutions

RRO
Contributor

It might has to do with the path as @Hubert Dudekโ€‹  already mentioned:

df = spark.read.csv("dbfs:/FileStore/tables/new.csv", sep=",", header='True')

View solution in original post

4 REPLIES 4

Hubert-Dudek
Esteemed Contributor III

Try to add /dbfs/ or dbfs: prefixโ€‹

Krishscientist
New Contributor III

Yeah..I tried all options...still no file exists..

So I am converting Py spark DF to Pandas DF...

I am interested to know why below is not working..

pdf = pd.read_csv('/FileStore/tables/new.csv',sep=',')

RRO
Contributor

It might has to do with the path as @Hubert Dudekโ€‹  already mentioned:

df = spark.read.csv("dbfs:/FileStore/tables/new.csv", sep=",", header='True')

Kaniz
Community Manager
Community Manager

Hi @Rafael Rockenbachโ€‹  and @Hubert Dudekโ€‹ , It was so nice to have your response. Thank you for the time you put into our community. I really want you to know how much we appreciate that.

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.