label keyword argument for resample causes an error when used with a groupby object · Issue #13235 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

import numpy as np import pandas as pd

index = pd.date_range('2000-01-01', freq='2D', periods=5) df = pd.DataFrame(index=index, data={'col1':[0,0,1,1,2], 'col2':[1,1,1,1,1]})

df.groupby('col1').resample('1W', label='left').sum()

The dataframe

            col1  col2
2000-01-01     0     1
2000-01-03     0     1
2000-01-05     1     1
2000-01-07     1     1
2000-01-09     2     1

Expected Output

                 col1  col2
col1
0    1999-12-26     0     1
     2000-01-02     0     1
1    2000-01-02     2     2
2    2000-01-02     2     1

Actual ouput

TypeError                                 Traceback (most recent call last)
<ipython-input-53-6e7ac0fde8b3> in <module>()
----> 1 df.groupby('col1').resample('1W', label='left').sum()

/Users/roycoding/venv-lib-upgrade/lib/python2.7/site-packages/pandas/core/groupby.pyc in resample(self, rule, *args, **kwargs)
   1080         """
   1081         from pandas.tseries.resample import get_resampler_for_grouping
-> 1082         return get_resampler_for_grouping(self, rule, *args, **kwargs)
   1083
   1084     @Substitution(name='groupby')

/Users/roycoding/venv-lib-upgrade/lib/python2.7/site-packages/pandas/tseries/resample.pyc in get_resampler_for_grouping(groupby, rule, how, fill_method, limit, kind, **kwargs)
    910                                        fill_method=fill_method,
    911                                        limit=limit,
--> 912                                        **kwargs)
    913
    914

TypeError: _maybe_process_deprecations() got an unexpected keyword argument 'label'

Without the label keyword, I get this (with expected right labeled dates):

                 col1  col2
col1
0    2000-01-02     0     1
     2000-01-09     0     1
1    2000-01-09     2     2
2    2000-01-09     2     1

output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.8.final.0
python-bits: 64
OS: Darwin
OS-release: 13.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 1.5.6
setuptools: 3.6
Cython: None
numpy: 1.11.0
scipy: 0.15.1
statsmodels: 0.6.1
xarray: None
IPython: 3.2.1
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: 2.5
matplotlib: 1.4.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: 0.9999999
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None