Closed
Description
In Pandas version 0.12, you could apply the Python built-in divmod
function to a Series
and an integer:
Enthought Canopy Python 2.7.6 | 64-bit | (default, Jun 4 2014, 16:42:26)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> pd.__version__
'0.12.0'
>>> divmod(pd.Series(range(4)), 2)
(0 0
1 0
2 1
3 1
dtype: int64, 0 0
1 1
2 0
3 1
dtype: int64)
>>>
With version >= 0.13, it appears that this usage is no longer supported:
Enthought Canopy Python 2.7.6 | 64-bit | (default, Jun 4 2014, 16:42:26)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> pd.__version__
'0.14.1'
>>> divmod(pd.Series(range(4)), 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for divmod(): 'Series' and 'int'
Was this change intentional?
Some context: I was using this to read a climate datafile that had a 4-digit column holding combined month and day values. The original code looked something like: month, day = divmod(df['MODA'], 100)
, but broke after upgrading to version 0.14.