Commit 8080fb43 authored by Levin Zimmermann's avatar Levin Zimmermann

Restricted: Allow newer pandas versions

There are newer pandas versions which still support python2. The latest
one which still supports py2 (0.24.x) has initially been released in 2019
and should therefore be quite stable and better supported. We should
therefore prepare ERP5 so that it support those newer versions.
parent 55b855c6
...@@ -489,7 +489,13 @@ else: ...@@ -489,7 +489,13 @@ else:
allow_type(pd.DatetimeIndex) allow_type(pd.DatetimeIndex)
allow_type(pd.MultiIndex) allow_type(pd.MultiIndex)
allow_type(pd.Index) allow_type(pd.Index)
try: # for pandas >= 0.20.x
allow_type(pd.RangeIndex)
except AttributeError: # BBB for pandas < 0.20.x
allow_type(pd.indexes.range.RangeIndex) allow_type(pd.indexes.range.RangeIndex)
try: # for pandas >= 0.20.x
allow_type(pd.Int64Index)
except AttributeError: # BBB for pandas < 0.20.x
allow_type(pd.indexes.numeric.Int64Index) allow_type(pd.indexes.numeric.Int64Index)
allow_type(pd.core.groupby.DataFrameGroupBy) allow_type(pd.core.groupby.DataFrameGroupBy)
allow_type(pd.core.groupby.SeriesGroupBy) allow_type(pd.core.groupby.SeriesGroupBy)
...@@ -513,10 +519,15 @@ else: ...@@ -513,10 +519,15 @@ else:
ContainerAssertions[pd.DataFrame] = _check_access_wrapper( ContainerAssertions[pd.DataFrame] = _check_access_wrapper(
pd.DataFrame, dict.fromkeys(dataframe_black_list, restrictedMethod)) pd.DataFrame, dict.fromkeys(dataframe_black_list, restrictedMethod))
try: # for pandas >= 0.20.x
pd_DatetimeIndex = pd.DatetimeIndex
except AttributeError: # BBB for pandas < 0.20.x
pd_DatetimeIndex = pd.tseries.index.DatetimeIndex
safetype.update(dict.fromkeys(( safetype.update(dict.fromkeys((
pd.DataFrame, pd.DataFrame,
pd.Series, pd.Series,
pd.tseries.index.DatetimeIndex, pd_DatetimeIndex,
pd.core.indexing._iLocIndexer, pd.core.indexing._iLocIndexer,
pd.core.indexing._LocIndexer, pd.core.indexing._LocIndexer,
pd.MultiIndex, pd.MultiIndex,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment