API: selection from a duplicated index of a Series return a Series? · Issue #5678 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@floux

Description

@floux

See below for discussion


In [19]: import pandas as pd

In [20]: import numpy as np

In [21]: import random

In [22]: df = pd.DataFrame(np.random.random_sample((20,5)), index=[random.choice('ABCDE') for x in range(20)])

In [23]: df.loc[:,0].ix['A'].median()
Out[23]: 0.57704085832236685

In [24]: pd.version.version
Out[24]: '0.12.0'


In [1]: import pandas as pd

In [2]: import numpy as np

In [3]: import random

In [4]: df = pd.DataFrame(np.random.random_sample((20,5)), index=[random.choice('ABCDE') for x in range(20)])

In [5]: df.loc[:,0].ix['A'].median()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-57f9fc9d1583> in <module>()
----> 1 df.loc[:,0].ix['A'].median()

AttributeError: 'numpy.ndarray' object has no attribute 'median'

In [6]: pd.version.version
Out[6]: '0.13.0rc1-43-g4f9fefc'