Skip to content

BUG: at with non-unique multi-index buggy #7965

@ojdo

Description

@ojdo

I fear that I somehow created a DataFrame with a numeric MultiIndex that triggers (un?)intended behaviour in the .loc function. I failed to create a reproducible example with anything but a pickled dump of a DataFrame.

Question Is this a bug, or a user error? I'm confused...

Steps to reproduce

  1. Get http://ojdo.de/tmp/df.pickle (17 kB)
  2. Execute
import pandas as pd
df = pd.read_pickle('df.pickle')
df.loc[(1,199), 'Elec']

Resulting output

Vertex1  Vertex2
1        199        7.602552
Name: Elec, dtype: float64

Expected output

The value on its own:
7.602552

It get's weirder

There must be something between row 80 and 90 in this DataFrame, because the following snippet yields a single value, while returing a Series if executed with .head(90).

In [20]: df2 = df.head(80)

In [21]: df2.loc[(1,199), 'Elec']
Out[21]: 7.6025524199999994

Installed versions

commit: None
python: 2.7.0.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.14.1
nose: 1.3.3
Cython: None
numpy: 1.8.1
scipy: 0.12.0
statsmodels: None
IPython: 0.13.2
sphinx: None
patsy: None
scikits.timeseries: None
dateutil: 1.5-mpl
pytz: 2012d
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.2.1
openpyxl: 2.0.2
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: 0.5.5
lxml: 3.3.5
bs4: 4.3.2
html5lib: 1.0b3
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: None
pymysql: None
psycopg2: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions