@@ -603,7 +603,7 @@ would include matching times on an included date:
603
603
dft = pd.DataFrame(
604
604
np.random.randn(100000 , 1 ),
605
605
columns = [" A" ],
606
- index = pd.date_range(" 20130101" , periods = 100000 , freq = " T " ),
606
+ index = pd.date_range(" 20130101" , periods = 100000 , freq = " min " ),
607
607
)
608
608
dft
609
609
dft.loc[" 2013" ]
@@ -905,11 +905,11 @@ into ``freq`` keyword arguments. The available date offsets and associated frequ
905
905
:class: `~pandas.tseries.offsets.CustomBusinessHour `, ``'CBH' ``, "custom business hour"
906
906
:class: `~pandas.tseries.offsets.Day `, ``'D' ``, "one absolute day"
907
907
:class: `~pandas.tseries.offsets.Hour `, ``'H' ``, "one hour"
908
- :class: `~pandas.tseries.offsets.Minute `, ``'T' `` or `` ' min' ``,"one minute"
909
- :class: `~pandas.tseries.offsets.Second `, ``'S ' ``, "one second"
910
- :class: `~pandas.tseries.offsets.Milli `, ``'L' `` or `` ' ms' ``, "one millisecond"
911
- :class: `~pandas.tseries.offsets.Micro `, ``'U' `` or `` ' us' ``, "one microsecond"
912
- :class: `~pandas.tseries.offsets.Nano `, ``'N ' ``, "one nanosecond"
908
+ :class: `~pandas.tseries.offsets.Minute `, ``'min' ``,"one minute"
909
+ :class: `~pandas.tseries.offsets.Second `, ``'s ' ``, "one second"
910
+ :class: `~pandas.tseries.offsets.Milli `, ``'ms' ``, "one millisecond"
911
+ :class: `~pandas.tseries.offsets.Micro `, ``'us' ``, "one microsecond"
912
+ :class: `~pandas.tseries.offsets.Nano `, ``'ns ' ``, "one nanosecond"
913
913
914
914
``DateOffsets `` additionally have :meth: `rollforward ` and :meth: `rollback `
915
915
methods for moving a date forward or backward respectively to a valid offset
@@ -1264,11 +1264,16 @@ frequencies. We will refer to these aliases as *offset aliases*.
1264
1264
"BAS, BYS", "business year start frequency"
1265
1265
"BH", "business hour frequency"
1266
1266
"H", "hourly frequency"
1267
- "T, min", "minutely frequency"
1268
- "S", "secondly frequency"
1269
- "L, ms", "milliseconds"
1270
- "U, us", "microseconds"
1271
- "N", "nanoseconds"
1267
+ "min", "minutely frequency"
1268
+ "s", "secondly frequency"
1269
+ "ms", "milliseconds"
1270
+ "us", "microseconds"
1271
+ "ns", "nanoseconds"
1272
+
1273
+ .. deprecated :: 2.2.0
1274
+
1275
+ Aliases ``T ``, ``S ``, ``L ``, ``U ``, and ``N `` are deprecated in favour of the aliases
1276
+ ``min ``, ``s ``, ``ms ``, ``us ``, and ``ns ``.
1272
1277
1273
1278
.. note ::
1274
1279
@@ -1318,11 +1323,16 @@ frequencies. We will refer to these aliases as *period aliases*.
1318
1323
"Q", "quarterly frequency"
1319
1324
"A, Y", "yearly frequency"
1320
1325
"H", "hourly frequency"
1321
- "T, min", "minutely frequency"
1322
- "S", "secondly frequency"
1323
- "L, ms", "milliseconds"
1324
- "U, us", "microseconds"
1325
- "N", "nanoseconds"
1326
+ "min", "minutely frequency"
1327
+ "s", "secondly frequency"
1328
+ "ms", "milliseconds"
1329
+ "us", "microseconds"
1330
+ "ns", "nanoseconds"
1331
+
1332
+ .. deprecated :: 2.2.0
1333
+
1334
+ Aliases ``T ``, ``S ``, ``L ``, ``U ``, and ``N `` are deprecated in favour of the aliases
1335
+ ``min ``, ``s ``, ``ms ``, ``us ``, and ``ns ``.
1326
1336
1327
1337
1328
1338
Combining aliases
@@ -1343,7 +1353,7 @@ You can combine together day and intraday offsets:
1343
1353
1344
1354
pd.date_range(start, periods = 10 , freq = " 2h20min" )
1345
1355
1346
- pd.date_range(start, periods = 10 , freq = " 1D10U " )
1356
+ pd.date_range(start, periods = 10 , freq = " 1D10us " )
1347
1357
1348
1358
Anchored offsets
1349
1359
~~~~~~~~~~~~~~~~
@@ -1635,7 +1645,7 @@ Basics
1635
1645
1636
1646
.. ipython :: python
1637
1647
1638
- rng = pd.date_range(" 1/1/2012" , periods = 100 , freq = " S " )
1648
+ rng = pd.date_range(" 1/1/2012" , periods = 100 , freq = " s " )
1639
1649
1640
1650
ts = pd.Series(np.random.randint(0 , 500 , len (rng)), index = rng)
1641
1651
@@ -1725,11 +1735,11 @@ For upsampling, you can specify a way to upsample and the ``limit`` parameter to
1725
1735
1726
1736
# from secondly to every 250 milliseconds
1727
1737
1728
- ts[:2 ].resample(" 250L " ).asfreq()
1738
+ ts[:2 ].resample(" 250ms " ).asfreq()
1729
1739
1730
- ts[:2 ].resample(" 250L " ).ffill()
1740
+ ts[:2 ].resample(" 250ms " ).ffill()
1731
1741
1732
- ts[:2 ].resample(" 250L " ).ffill(limit = 2 )
1742
+ ts[:2 ].resample(" 250ms " ).ffill(limit = 2 )
1733
1743
1734
1744
Sparse resampling
1735
1745
~~~~~~~~~~~~~~~~~
@@ -1752,7 +1762,7 @@ If we want to resample to the full range of the series:
1752
1762
1753
1763
.. ipython :: python
1754
1764
1755
- ts.resample(" 3T " ).sum()
1765
+ ts.resample(" 3min " ).sum()
1756
1766
1757
1767
We can instead only resample those groups where we have points as follows:
1758
1768
@@ -1766,7 +1776,7 @@ We can instead only resample those groups where we have points as follows:
1766
1776
freq = to_offset(freq)
1767
1777
return pd.Timestamp((t.value // freq.delta.value) * freq.delta.value)
1768
1778
1769
- ts.groupby(partial(round , freq = " 3T " )).sum()
1779
+ ts.groupby(partial(round , freq = " 3min " )).sum()
1770
1780
1771
1781
.. _timeseries.aggregate :
1772
1782
@@ -1783,10 +1793,10 @@ Resampling a ``DataFrame``, the default will be to act on all columns with the s
1783
1793
1784
1794
df = pd.DataFrame(
1785
1795
np.random.randn(1000 , 3 ),
1786
- index = pd.date_range(" 1/1/2012" , freq = " S " , periods = 1000 ),
1796
+ index = pd.date_range(" 1/1/2012" , freq = " s " , periods = 1000 ),
1787
1797
columns = [" A" , " B" , " C" ],
1788
1798
)
1789
- r = df.resample(" 3T " )
1799
+ r = df.resample(" 3min " )
1790
1800
r.mean()
1791
1801
1792
1802
We can select a specific column or columns using standard getitem.
@@ -2155,7 +2165,7 @@ Passing a string representing a lower frequency than ``PeriodIndex`` returns par
2155
2165
dfp = pd.DataFrame(
2156
2166
np.random.randn(600 , 1 ),
2157
2167
columns = [" A" ],
2158
- index = pd.period_range(" 2013-01-01 9:00" , periods = 600 , freq = " T " ),
2168
+ index = pd.period_range(" 2013-01-01 9:00" , periods = 600 , freq = " min " ),
2159
2169
)
2160
2170
dfp
2161
2171
dfp.loc[" 2013-01-01 10H" ]
0 commit comments