Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dannymeijer committed Jun 4, 2024
1 parent 969c901 commit e61f37a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/koheesio/spark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ def import_pandas_based_on_pyspark_version():
"""
try:
import pandas as pd

pyspark_version = get_spark_minor_version()
pandas_version = pd.__version__

if (pyspark_version < 3.4 and pandas_version >= '2') or (pyspark_version >= 3.4 and pandas_version < '2'):
raise ImportError(f"For PySpark {pyspark_version}, please install Pandas version {'< 2' if pyspark_version < 3.4 else '>= 2'}")
if (pyspark_version < 3.4 and pandas_version >= "2") or (pyspark_version >= 3.4 and pandas_version < "2"):
raise ImportError(
f"For PySpark {pyspark_version}, "
f"please install Pandas version {'< 2' if pyspark_version < 3.4 else '>= 2'}"
)

return pd
except ImportError:
Expand Down

0 comments on commit e61f37a

Please sign in to comment.