Skip to content

Instantly share code, notes, and snippets.

View mereldawu's full-sized avatar

Merelda mereldawu

View GitHub Profile
@mereldawu
mereldawu / pandas_to_spark.py
Created January 27, 2021 13:57 — forked from zaloogarcia/pandas_to_spark.py
Script for converting Pandas DF to Spark's DF
from pyspark.sql.types import *
# Auxiliar functions
# Pandas Types -> Sparks Types
def equivalent_type(f):
if f == 'datetime64[ns]': return DateType()
elif f == 'int64': return LongType()
elif f == 'int32': return IntegerType()
elif f == 'float64': return FloatType()
else: return StringType()