How to convert spark dataframe to pandas dataframe and save it in csv I have this sql query and I am running it in spark cluster jupyter notebook: