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

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!