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

Allow Timeseries-like shortcuts in dataframes __getitem__ #3070

Closed
ghost opened this issue Mar 17, 2013 · 0 comments · Fixed by #3137

Comments

@ghost
Copy link

commented Mar 17, 2013

In [17]: s=pd.date_range("2001-1-1", periods=12)
In [20]: ts['2001']
Out[20]: 
2001-01-01     0
2001-01-02     1
2001-01-03     2
2001-01-04     3
2001-01-05     4
2001-01-06     5
2001-01-07     6
2001-01-08     7
2001-01-09     8
2001-01-10     9
2001-01-11    10
2001-01-12    11
Freq: D, dtype: int64

In [24]: df=pd.DataFrame(range(len(s)),index=s)
In [25]: df['2001']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
KeyError: u'no item named 2001'

In [27]: df.index is ts.index
Out[27]: True

related #2091

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.