Skip to content

pandas index does not give expected behaviour when raised to a power #15565

Closed
@lingxz

Description

@lingxz

Code Sample, a copy-pastable example if possible

>>> import pandas as pd
>>> test = list(range(5))
>>> a = pd.Series(test, index=test)
>>> a.index
Int64Index([0, 1, 2, 3, 4], dtype='int64')
>>> 0.5**a.index
Float64Index([0.0, 1.0, 1.41421356237, 1.73205080757, 2.0], dtype='float64')

Problem description

The index doesn't seem to behave properly when it is being raised to the power. It is not giving the correct values. It seems to work well with other operations like multiplication.

Expected Output

Float64Index(array([ 1.    ,  0.5   ,  0.25  ,  0.125 ,  0.0625]), dtype='float64')

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.2.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None

pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 27.2.0
Cython: None
numpy: 1.11.3
scipy: 0.18.1
statsmodels: None
xarray: 0.9.1
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.3
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.4
boto: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDuplicate ReportDuplicate issue or pull requestNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions