Reputation: 11
I'm having trouble using pandas
I get this error:
AttributeError: partially initialized module 'pandas' has no attribute '__version__' (most likely due to a circular import).
What can it be? The library is installed, but I can't use it.
This is the start of my code:
import pandas as pd
And the error:
AttributeError Traceback (most recent call last)
<ipython-input-42-84d5e4747099> in <cell line: 1>()
----> 1 import pandas as pd
1 frames
/content/spark-3.5.1-bin-hadoop3/python/lib/pyspark.zip/pyspark/sql/pandas/utils.py in require_minimum_pandas_version()
35 "Pandas >= %s must be installed; however, " "it was not found." % minimum_pandas_version
36 ) from raised_error
---> 37 if LooseVersion(pandas.__version__) < LooseVersion(minimum_pandas_version):
38 raise ImportError(
39 "Pandas >= %s must be installed; however, "
AttributeError: partially initialized module 'pandas' has no attribute '__version__' (most likely due to a circular import)
Upvotes: 1
Views: 196
Reputation: 1
Its because you are importing pandas as pd and using pandas to check version which cannot be done.
Replace:
pandas.__version__
With:
pd.__version__
Upvotes: -3