Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ Performance Improvements
Bug Fixes
~~~~~~~~~

- Bug in ``Index`` power operations with reversed operands(:issue:`14973`)
- Bug in ``TimedeltaIndex`` addition where overflow was being allowed without error (:issue:`14816`)
- Bug in ``DataFrame`` construction in which unsigned 64-bit integer elements were being converted to objects (:issue:`14881`)
- Bug in ``astype()`` where ``inf`` values were incorrectly converted to integers. Now raises error now with ``astype()`` for Series and DataFrames (:issue:`14265`)
Expand Down
4 changes: 3 additions & 1 deletion pandas/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3534,7 +3534,9 @@ def _evaluate_numeric_binop(self, other):
operator.sub, '__sub__', reversed=True)
cls.__mul__ = cls.__rmul__ = _make_evaluate_binop(
operator.mul, '__mul__')
cls.__pow__ = cls.__rpow__ = _make_evaluate_binop(
cls.__rpow__ = _make_evaluate_binop(
operator.pow, '__pow__', reversed=True)
cls.__pow__ = _make_evaluate_binop(
operator.pow, '__pow__')
cls.__mod__ = _make_evaluate_binop(
operator.mod, '__mod__')
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/indexes/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ def test_numeric_compat(self):
for r, e in zip(result, expected):
tm.assert_index_equal(r, e)

# test power calculations both ways, GH 14973
expected = pd.Float64Index(2.0**idx.values)
result = 2.0**idx
tm.assert_index_equal(result, expected)

expected = pd.Float64Index(idx.values**2.0)
result = idx**2.0
tm.assert_index_equal(result, expected)

def test_explicit_conversions(self):

# GH 8608
Expand Down