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

TimedeltaIndex raises error when slicing from '0s' #10583

Closed
JonasAbernot opened this issue Jul 15, 2015 · 5 comments · Fixed by #10960
Closed

TimedeltaIndex raises error when slicing from '0s' #10583

JonasAbernot opened this issue Jul 15, 2015 · 5 comments · Fixed by #10960
Labels
Bug Timedelta Timedelta data type
Milestone

Comments

@JonasAbernot
Copy link
Contributor

import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.normal(size=(10,4)))
df.index = pd.timedelta_range(start='0s', periods=10, freq='s')

print(df.loc['0s':,:])

raises a ValueError: invalid resolution, while print(df.loc['5s':,:]) works.

Workaround : print(df.loc[pd.Timedelta('0s'):,:])

INSTALLED VERSIONS
------------------
commit: 6246cc1bb5149863de09b470530b69f7e22cad87
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-57-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: fr_FR.UTF-8

pandas: 0.16.2-138-g6246cc1
nose: 1.3.1
Cython: 0.20.1post0
numpy: 1.8.2
scipy: 0.13.3
statsmodels: None
IPython: 1.2.1
sphinx: 1.2.2
patsy: None
dateutil: 2.4.1
pytz: 2013b
bottleneck: None
tables: 3.1.1
numexpr: 2.2.2
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: 0.7.5
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.8
apiclient: None
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None
@jreback
Copy link
Contributor

jreback commented Jul 15, 2015

https://github.com/pydata/pandas/blob/master/pandas/tslib.pyx#L2213

should be

else:
   return "D"

I guess the raise doesn't make sense.

@jreback jreback added Bug Timedelta Timedelta data type labels Jul 15, 2015
@jreback jreback modified the milestones: Next Major Release, 0.17.0 Jul 15, 2015
@jreback jreback modified the milestones: Next Major Release, 0.17.0 Aug 20, 2015
@terrytangyuan
Copy link
Contributor

@jreback no one is working on this, right? I'll submit a PR soon.

@jreback
Copy link
Contributor

jreback commented Aug 31, 2015

nope

@terrytangyuan
Copy link
Contributor

Where should I put the test for this? @jreback Thanks.

@jreback
Copy link
Contributor

jreback commented Sep 1, 2015

test_timedeltas.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timedelta Timedelta data type
Projects
None yet
3 participants