Skip to content

Instantly share code, notes, and snippets.

View prbehere93's full-sized avatar
🎨
Learning

Pratyush Behere prbehere93

🎨
Learning
View GitHub Profile
@mattharrison
mattharrison / Idiomatic Pandas.ipynb
Last active February 14, 2024 20:58
Idiomatic Pandas: 5 tips for better pandas code
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joshlk
joshlk / faster_toPandas.py
Last active May 15, 2023 13:48
PySpark faster toPandas using mapPartitions
import pandas as pd
def _map_to_pandas(rdds):
""" Needs to be here due to pickling issues """
return [pd.DataFrame(list(rdds))]
def toPandas(df, n_partitions=None):
"""
Returns the contents of `df` as a local `pandas.DataFrame` in a speedy fashion. The DataFrame is
repartitioned if `n_partitions` is passed.