Kiran Joseph
Kiran Joseph

Reputation: 45

Getting error while importing panda in python 3.7

Getting the error while importing panda

Traceback (most recent call last):
  File "C:/Users/kj/PycharmProjects/kj/parsing.py", line 5, in <module>
    import pandas
  File "H:\Python\New\lib\pandas\__init__.py", line 23, in <module>
    from pandas.compat.numpy import *
  File "H:\Python\New\lib\pandas\compat\__init__.py", line 421, in <module>
    if LooseVersion(dateutil.__version__) < LooseVersion('2.5'):
  File "C:\Program Files\Python\Python37\Lib\distutils\version.py", line 52, in __lt__
    c = self._cmp(other)
  File "C:\Program Files\Python\Python37\Lib\distutils\version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'

import pandas
df = pandas.read_excel(open('Test.csv','rb'), sheetname='Sheet 1')
grouped = df.groupby('Date (IT)')

Upvotes: 2

Views: 984

Answers (2)

theophilus okoye
theophilus okoye

Reputation: 1

I don't have PyCharm installed at the moment but in the command line you can try to run:

pip uninstall pandas 

followed by a reinstall : pip install pandas

Or you can always try to run it from PyCharm. It will automatically suggest to install the missing package.

Upvotes: 0

Vlad Bezden
Vlad Bezden

Reputation: 89499

Looks like your Date (IT) column has mixed values (string and integers, dates, or missing values). So when pandas try to compare each value it fails because of different types. Please take a look at the column data and make sure all data is in a valid format.

Upvotes: 1

Related Questions