In pandas 0.15, a DataFrame's index no longer supports the modulo operator. I believe the following code used to work under pandas 0.14, but under pandas 0.15, a TypeError indicating "unsupported operand types" is raised:
In [1]: import pandas
In [2]: print pandas.version.version
0.15.2
In [3]: df = pandas.DataFrame({ 'i': xrange(10) })
In [4]: df.index
Out[4]: Int64Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64')
In [5]: r = df.index % 2
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-405b698d3a56> in <module>()
----> 1 r = df.index % 2
TypeError: unsupported operand type(s) for %: 'Int64Index' and 'int'
In [6]: r = df.index.to_series() % 2
In [7]:
Line 6 shows that a workaround exists, using the to_series() function.
This issue is very similar to Issue #8608, which dealt with other arithemtic operations on an index. Pandas commit 2fcbc7f fixed that issue by adding addition, subtraction, multiplication, division, and unary operators, but not the modulo operator.
Comment From: jorisvandenbossche
This is a duplicate of #9244, so closing. But thanks for the report!