Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: resample options with TimedeltaIndex not working #15167

Closed
perellonieto opened this issue Jan 19, 2017 · 1 comment
Closed

Bug: resample options with TimedeltaIndex not working #15167

perellonieto opened this issue Jan 19, 2017 · 1 comment
Labels
Resample resample method Timedelta Timedelta data type

Comments

@perellonieto
Copy link

Code Sample, a copy-pastable example if possible

import pandas as pd

index = pd.timedelta_range('0', periods=4, freq='s')
series = pd.Series(range(4), index=index)
print series

print series.resample('2s', label='left').sum()

print series.resample('2s', label='right').sum()

print series.resample('2s', label='right', closed='right').sum()

The output

00:00:00    0
00:00:01    1
00:00:02    2
00:00:03    3
Freq: S, dtype: int64
00:00:00    1
00:00:02    5
Freq: 2S, dtype: int64
00:00:00    1
00:00:02    5
Freq: 2S, dtype: int64
00:00:00    1
00:00:02    5
Freq: 2S, dtype: int64

Problem description

When calling the function resample with a DatetimeIndex works as expected. However, if called with a TimedeltaIndex the options label and closed does not work.

Expected Output

00:00:00    0
00:00:01    1
00:00:02    2
00:00:03    3
Freq: S, dtype: int64
00:00:00    1
00:00:02    5
Freq: 2S, dtype: int64
00:00:02    1
00:00:04    5
Freq: 2S, dtype: int64
00:00:00    0
00:00:02    3
00:00:04    3
Freq: 2S, dtype: int64

Output of pd.show_versions()

# Paste the output here pd.show_versions() here

INSTALLED VERSIONS

commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-74-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: None.None

pandas: 0.19.2
nose: 1.3.1
pip: 9.0.1
setuptools: 28.8.0
Cython: 0.24.1
numpy: 1.12.0
scipy: 0.18.1
statsmodels: 0.5.0
xarray: None
IPython: 4.1.2
sphinx: 1.4.6
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: 3.1.1
numexpr: 2.2.2
matplotlib: 1.5.3
openpyxl: 1.7.0
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: None
lxml: None
bs4: 4.2.1
html5lib: 0.999
httplib2: 0.8
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: 2.4.5 (dt dec mx pq3 ext)
jinja2: 2.8
boto: None
pandas_datareader: None

@jreback
Copy link
Contributor

jreback commented Jan 19, 2017

this is a duplicate of #13022

PR's are welcome if you want to debug.

@jreback jreback closed this as completed Jan 19, 2017
@jreback jreback added Resample resample method Timedelta Timedelta data type labels Jan 19, 2017
@jreback jreback added this to the No action milestone Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resample resample method Timedelta Timedelta data type
Projects
None yet
Development

No branches or pull requests

2 participants