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: 

Pandas finds parquet file, Spark does not

JonW
New Contributor

I am having an issue with Databricks (Community Edition) where I can use Pandas to read a parquet file into a dataframe, but when I use Spark it states the file doesn't exist. I have tried reformatting the file path for spark but I can't seem to find a format that it will accept.

Any ideas?

Pandas:

 

 

parquet_file_path = "/dbfs/green_tripdata_2022-02.parquet"
df = pd.read_parquet(parquet_file_path, engine='pyarrow')
display(df)

 

 

Result:

JonW_1-1703880035484.png

Spark:

 

parquet_file_path = "/dbfs/green_tripdata_2022-02.parquet"
df = spark.read.parquet(parquet_file_path)
df.show()

 

2 REPLIES 2

Wojciech_BUK
Valued Contributor III

Can you check those 3 options ? I don't remember which one will work and can't test it now, but I am sore one or two of those will work 🙂

parquet_file_path = "/green_tripdata_2022-02.parquet"

parquet_file_path = "green_tripdata_2022-02.parquet"

parquet_file_path = "dbfs:/green_tripdata_2022-02.parquet"

 

jose_gonzalez
Databricks Employee
Databricks Employee

Are you getting any error messages? what happens when you do a "ls /dbfs/"? are you able to list all the parquet files?

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