Skip to content

Commit c6cbda3

Browse files
committed
deprecate 'c',fix examples in v0.22.0, add tests and a note to v3.0.0
1 parent 2f0bead commit c6cbda3

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

doc/source/whatsnew/v0.22.0.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,27 @@ sum and ``1`` for product.
157157
158158
*pandas 0.22.0*
159159

160-
.. ipython:: python
160+
.. code-block:: ipython
161+
162+
In [11]: s = pd.Series([1, 1, np.nan, np.nan],
163+
....: index=pd.date_range("2017", periods=4))
161164
162-
s = pd.Series([1, 1, np.nan, np.nan], index=pd.date_range("2017", periods=4))
163-
s.resample("2d").sum()
165+
In [12]: s.resample("2d").sum()
166+
Out[12]:
167+
2017-01-01 2.0
168+
2017-01-03 0.0
169+
Freq: 2D, Length: 2, dtype: float64
164170
165171
To restore the 0.21 behavior of returning ``NaN``, use ``min_count>=1``.
166172

167-
.. ipython:: python
173+
.. code-block:: ipython
174+
175+
In [13]: s.resample("2d").sum(min_count=1)
176+
Out[13]:
177+
2017-01-01 2.0
178+
2017-01-03 NaN
179+
Freq: 2D, Length: 2, dtype: float64
168180
169-
s.resample("2d").sum(min_count=1)
170181
171182
In particular, upsampling and taking the sum or product is affected, as
172183
upsampling introduces missing values even if the original series was

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ Other Deprecations
272272
- Deprecated allowing non-keyword arguments in :meth:`Series.to_markdown` except ``buf``. (:issue:`57280`)
273273
- Deprecated allowing non-keyword arguments in :meth:`Series.to_string` except ``buf``. (:issue:`57280`)
274274
- Deprecated behavior of :meth:`Series.dt.to_pytimedelta`, in a future version this will return a :class:`Series` containing python ``datetime.timedelta`` objects instead of an ``ndarray`` of timedelta; this matches the behavior of other :meth:`Series.dt` properties. (:issue:`57463`)
275+
- Deprecated lowercase strings ``d``, ``b`` and ``c`` denoting frequencies in :class:`Day`, :class:`BusinessDay` and :class:`CustomBusinessDay` in favour of ``D``, ``B`` and ``C`` (:issue:`58998`)
276+
- Deprecated lowercase strings ``w``, ``w-mon``, ``w-tue``, etc. denoting frequencies in :class:`Week` in favour of ``W``, ``W-MON``, ``W-TUE``, etc. (:issue:`58998`)
275277
- Deprecated parameter ``method`` in :meth:`DataFrame.reindex_like` / :meth:`Series.reindex_like` (:issue:`58667`)
276278
- Deprecated using ``epoch`` date format in :meth:`DataFrame.to_json` and :meth:`Series.to_json`, use ``iso`` instead. (:issue:`57063`)
277279

pandas/_libs/tslibs/dtypes.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ cdef dict c_PERIOD_AND_OFFSET_DEPR_FREQSTR = {
357357
"w-sun": "W-SUN",
358358
"d": "D",
359359
"b": "B",
360+
"c": "C",
360361
"MIN": "min",
361362
}
362363

pandas/tests/indexes/datetimes/test_date_range.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ def test_frequency_A_raises(self, freq):
795795
("2W-WED", "2w-wed"),
796796
("2B", "2b"),
797797
("2D", "2d"),
798+
("2C", "2c"),
798799
],
799800
)
800801
def test_date_range_depr_lowercase_frequency(self, freq, freq_depr):

pandas/tests/resample/test_datetime_index.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,7 @@ def test_resample_BM_BQ_raises(freq):
20442044
("1W-SUN", "1w-sun", ["2013-01-06"]),
20452045
("1D", "1d", ["2013-01-01"]),
20462046
("1B", "1b", ["2013-01-01"]),
2047+
("1C", "1c", ["2013-01-01"]),
20472048
],
20482049
)
20492050
def test_resample_depr_lowercase_frequency(freq, freq_depr, data):

0 commit comments

Comments
 (0)