File tree 1 file changed +19
-7
lines changed
1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -367,15 +367,27 @@ Enhancements
367
367
368
368
- You can now select with a string from a DataFrame with a datelike index, in a similar way to a Series (:issue: `3070 `)
369
369
370
- .. ipython :: python
371
- :okexcept:
370
+ .. code-block :: ipython
372
371
373
- idx = pd.date_range(" 2001-10-1" , periods = 5 , freq = ' M' )
374
- ts = pd.Series(np.random.rand(len (idx)), index = idx)
375
- ts[' 2001' ]
372
+ In [30]: idx = pd.date_range("2001-10-1", periods=5, freq='M')
376
373
377
- df = pd.DataFrame({' A' : ts})
378
- df[' 2001' ]
374
+ In [31]: ts = pd.Series(np.random.rand(len(idx)), index=idx)
375
+
376
+ In [32]: ts['2001']
377
+ Out[32]:
378
+ 2001-10-31 0.117967
379
+ 2001-11-30 0.702184
380
+ 2001-12-31 0.414034
381
+ Freq: M, dtype: float64
382
+
383
+ In [33]: df = pd.DataFrame({'A': ts})
384
+
385
+ In [34]: df['2001']
386
+ Out[34]:
387
+ A
388
+ 2001-10-31 0.117967
389
+ 2001-11-30 0.702184
390
+ 2001-12-31 0.414034
379
391
380
392
- ``Squeeze `` to possibly remove length 1 dimensions from an object.
381
393
You can’t perform that action at this time.
0 commit comments