Description
Code Sample, a copy-pastable example if possible
import pandas as pd
df = pd.DataFrame([[0, 0],
[3, 0],
[1, 1]], index=list('ABC'), columns=list('ab'))
gby = df.groupby(by='b')
print(type(gby)) # <class 'pandas.core.groupby.DataFrameGroupBy'>
print(type(gby.idxmin())) # <class 'pandas.core.frame.DataFrame'>
Problem description
According to the documentation, this is supposed to output a pandas.core.Series
. To me, that seems to be what makes sense, but I'm not sure how or why this ended up returning a DataFrame
. Is this just an issue with the documentation, or is it an issue with the code?
Edit: Ah, I understand why this returns a DataFrame
now - if you have multiple columns the idxmin()
might be different for each column. Seems that the documentation needs to be updated. I can make a PR if that's appropriate.
Output of pd.show_versions()
pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 34.0.3
Cython: 0.25.2
numpy: 1.12.0
scipy: None
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None