Skip to content

Correction in DatetimeIndex in Time Series documentation #2554

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

Closed
kentwait opened this issue Dec 17, 2012 · 5 comments
Closed

Correction in DatetimeIndex in Time Series documentation #2554

kentwait opened this issue Dec 17, 2012 · 5 comments

Comments

@kentwait
Copy link

In the Time Series documentation (http://pandas.pydata.org/pandas-docs/stable/timeseries.html), DatetimeIndex is said to have the following functionality:

In [1118]: ts['2011']
Out[1118]: 
2011-01-31   -1.281247
2011-02-28   -0.727707
2011-03-31   -0.121306
2011-04-29   -0.097883
2011-05-31    0.695775
2011-06-30    0.341734
2011-07-29    0.959726
2011-08-31   -1.110336
2011-09-30   -0.619976
2011-10-31    0.149748
2011-11-30   -0.732339
2011-12-30    0.687738
Freq: BM

In [1119]: ts['2011-6']
Out[1119]: 
2011-06-30    0.341734
Freq: BM

I have tried it out in pandas 0.9.1 but it doesn't work.

What does work is ts.ix['2011'] and ts.ix['2011-6]. I hope you correct this misleading mistake. There are a couple more examples of these on that page so please check it out.

@changhiskhan
Copy link
Contributor

This works on master and 0.9.1 for me. Can you show me a standalone reproduction of how it's not working for you?

@kentwait
Copy link
Author

Now I see where I misunderstood it. The examples were all <class 'pandas.core.series.TimeSeries'> objects and naturally Series['filter'] will work for a Series but it will not work for a DataFrame.

I guess I just assumed that it the example was true for any data structure with a Datetime index.

@changhiskhan
Copy link
Contributor

Ah i see. Yeah, DataFrame[label] assume you want to access a column.

@e9t
Copy link

e9t commented May 27, 2013

It would be wonderful to have this feature for data frames as well.

@jreback
Copy link
Contributor

jreback commented May 27, 2013

this is in 0.11.0 via #3137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants