Problem with Pandas running Lesson 3


(Maxwell McKinnon) #1

As no one else is having this issue (did a forum search and stack overflow search), it must be a setup issue. I did a conda env update and git pull. Both are up to date. Surely some similar setup issue must still be the issue as lesson 3 seems to be working fine for others here - searching this error brings up nothing on these forums.

pip list | grep pandas
pandas 0.23.0
pandas-summary 0.0.41
sklearn-pandas 1.6.0

Any ideas?

AttributeError: module ‘pandas.core.common’ has no attribute ‘is_numeric_dtype’

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-5fc2f9e3ed3e> in <module>()
----> 1 DataFrameSummary(tables[4])

~/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas_summary/__init__.py in __init__(self, df)
     25         self.df = df
     26         self.length = len(df)
---> 27         self.columns_stats = self._get_stats()
     28         self.corr = df.corr()
     29 

~/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas_summary/__init__.py in _get_stats(self)
     87         # settings types
     88         stats['types'] = ''
---> 89         columns_info = self._get_columns_info(stats)
     90         for ctype, columns in columns_info.items():
     91             stats.ix[columns, 'types'] = ctype

~/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas_summary/__init__.py in _get_columns_info(self, stats)
    109                                         self.EXCLUDE,
    110                                         column_info['constant'].union(column_info['bool']))
--> 111         column_info[self.TYPE_NUMERIC] = pd.Index([c for c in rest_columns
    112                                                    if common.is_numeric_dtype(self.df[c])])
    113         rest_columns = self.get_columns(self.df[rest_columns], self.EXCLUDE, column_info['numeric'])

~/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas_summary/__init__.py in <listcomp>(.0)
    110                                         column_info['constant'].union(column_info['bool']))
    111         column_info[self.TYPE_NUMERIC] = pd.Index([c for c in rest_columns
--> 112                                                    if common.is_numeric_dtype(self.df[c])])
    113         rest_columns = self.get_columns(self.df[rest_columns], self.EXCLUDE, column_info['numeric'])
    114         column_info[self.TYPE_DATE] = pd.Index([c for c in rest_columns

AttributeError: module 'pandas.core.common' has no attribute 'is_numeric_dtype'

(Raynier van Egmond) #2

Hi Maxwell - no solution… just to mention I started lesson 3 and have the same issue… Did you find a solution yet…?


(Nick) #3

It looks like pandas.core.common.is_numeric_dtype was removed in 0.23.
It works ok in 0.22. So you can either downgrade to 0.22 or update pandas-summary as it has been fixed few days ago https://github.com/mouradmourafiq/pandas-summary/commit/2a05d97be8e97f50221fb0174bcca8661e187a35


(Raynier van Egmond) #5

A simple downgrade using ‘conda install pandas=0.22’ seems to work on the particular issue of the pandas libraries where pandas=0.23 causes the code to crash. With the new pandas=0.23 there was also an issue later in the notebook where the use of AfterStateHoliday’ andBeforeStateHoliday` resulted in NaNs where they were not expected causing another crash. (original cell 68-ish)

The downgrade seems to have also solved that problem since the code runs through the notebook into a past the deep learning sections.

It looks like the downgrade as suggested by Nick - “bny6613” solves all the issue in the lesson 3 notebook - at least for me …

Thanks a million for this solution - hard to solve be noobs like myself.


(Stas Bekman) #6

This fix hasn’t been released yet as a package, only in a git branch, which can be installed as:

pip install -e git+https://github.com/mouradmourafiq/pandas-summary#egg=pandas-summary

instead of downgrading pandas.