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: 

Iteration - Pyspark vs Pandas

elgeo
Valued Contributor II

Hello. Could someone please explain why iteration over a Pyspark dataframe is way slower than over a Pandas dataframe?

Pyspark

df_list = df.collect()

for index in range(0, len(df_list )):

.....

Pandas

df_pnd = df.toPandas()           

for index, row in df_pnd.iterrows():

....

Thank you in advance

1 REPLY 1

Anonymous
Not applicable

Hi @ELENI GEORGOUSI​ 

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!

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