Skip to content

Commit 053d64b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into cow_warn_mode_interpolate_new
2 parents 27eb8c7 + 639bd66 commit 053d64b

File tree

165 files changed

+3001
-2655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+3001
-2655
lines changed

.github/workflows/comment-commands.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
echo 'EOF' >> $GITHUB_ENV
7878
echo "REGEX=$REGEX" >> $GITHUB_ENV
7979
80-
- uses: actions/github-script@v6
80+
- uses: actions/github-script@v7
8181
env:
8282
BENCH_OUTPUT: ${{env.BENCH_OUTPUT}}
8383
REGEX: ${{env.REGEX}}

.github/workflows/deprecation-tracking-bot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
env:
2222
DEPRECATION_TRACKER_ISSUE: 50578
2323
steps:
24-
- uses: actions/github-script@v6
24+
- uses: actions/github-script@v7
2525
id: update-deprecation-issue
2626
with:
2727
script: |

asv_bench/benchmarks/indexing.py

+4
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ def time_loc_null_slice_plus_slice(self, unique_levels):
306306
target = (self.tgt_null_slice, self.tgt_slice)
307307
self.df.loc[target, :]
308308

309+
def time_loc_multiindex(self, unique_levels):
310+
target = self.df.index[::10]
311+
self.df.loc[target]
312+
309313
def time_xs_level_0(self, unique_levels):
310314
target = self.tgt_scalar
311315
self.df.xs(target, level=0)

asv_bench/benchmarks/io/csv.py

+11
Original file line numberDiff line numberDiff line change
@@ -621,4 +621,15 @@ def time_read_csv_index_col(self):
621621
)
622622

623623

624+
class ReadCSVCParserLowMemory:
625+
# GH 16798
626+
def setup(self):
627+
self.csv = StringIO(
628+
"strings\n" + "\n".join(["x" * (1 << 20) for _ in range(2100)])
629+
)
630+
631+
def peakmem_over_2gb_input(self):
632+
read_csv(self.csv, engine="c", low_memory=False)
633+
634+
624635
from ..pandas_vb_common import setup # noqa: F401 isort:skip

doc/source/user_guide/copy_on_write.rst

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
Copy-on-Write (CoW)
77
*******************
88

9+
.. note::
10+
11+
Copy-on-Write will become the default in pandas 3.0. We recommend
12+
:ref:`turning it on now <copy_on_write_enabling>`
13+
to benefit from all improvements.
14+
915
Copy-on-Write was first introduced in version 1.5.0. Starting from version 2.0 most of the
1016
optimizations that become possible through CoW are implemented and supported. All possible
1117
optimizations are supported starting from pandas 2.1.
@@ -123,6 +129,8 @@ CoW triggers a copy when ``df`` is changed to avoid mutating ``view`` as well:
123129
df
124130
view
125131
132+
.. _copy_on_write_chained_assignment:
133+
126134
Chained Assignment
127135
------------------
128136

@@ -238,6 +246,8 @@ and :meth:`DataFrame.rename`.
238246
These methods return views when Copy-on-Write is enabled, which provides a significant
239247
performance improvement compared to the regular execution.
240248

249+
.. _copy_on_write_enabling:
250+
241251
How to enable CoW
242252
-----------------
243253

doc/source/user_guide/indexing.rst

+48
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,22 @@ You can assign a custom index to the ``index`` attribute:
17271727
Returning a view versus a copy
17281728
------------------------------
17291729

1730+
.. warning::
1731+
1732+
:ref:`Copy-on-Write <copy_on_write>`
1733+
will become the new default in pandas 3.0. This means than chained indexing will
1734+
never work. As a consequence, the ``SettingWithCopyWarning`` won't be necessary
1735+
anymore.
1736+
See :ref:`this section <copy_on_write_chained_assignment>`
1737+
for more context.
1738+
We recommend turning Copy-on-Write on to leverage the improvements with
1739+
1740+
```
1741+
pd.options.mode.copy_on_write = True
1742+
```
1743+
1744+
even before pandas 3.0 is available.
1745+
17301746
When setting values in a pandas object, care must be taken to avoid what is called
17311747
``chained indexing``. Here is an example.
17321748

@@ -1765,6 +1781,22 @@ faster, and allows one to index *both* axes if so desired.
17651781
Why does assignment fail when using chained indexing?
17661782
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17671783

1784+
.. warning::
1785+
1786+
:ref:`Copy-on-Write <copy_on_write>`
1787+
will become the new default in pandas 3.0. This means than chained indexing will
1788+
never work. As a consequence, the ``SettingWithCopyWarning`` won't be necessary
1789+
anymore.
1790+
See :ref:`this section <copy_on_write_chained_assignment>`
1791+
for more context.
1792+
We recommend turning Copy-on-Write on to leverage the improvements with
1793+
1794+
```
1795+
pd.options.mode.copy_on_write = True
1796+
```
1797+
1798+
even before pandas 3.0 is available.
1799+
17681800
The problem in the previous section is just a performance issue. What's up with
17691801
the ``SettingWithCopy`` warning? We don't **usually** throw warnings around when
17701802
you do something that might cost a few extra milliseconds!
@@ -1821,6 +1853,22 @@ Yikes!
18211853
Evaluation order matters
18221854
~~~~~~~~~~~~~~~~~~~~~~~~
18231855

1856+
.. warning::
1857+
1858+
:ref:`Copy-on-Write <copy_on_write>`
1859+
will become the new default in pandas 3.0. This means than chained indexing will
1860+
never work. As a consequence, the ``SettingWithCopyWarning`` won't be necessary
1861+
anymore.
1862+
See :ref:`this section <copy_on_write_chained_assignment>`
1863+
for more context.
1864+
We recommend turning Copy-on-Write on to leverage the improvements with
1865+
1866+
```
1867+
pd.options.mode.copy_on_write = True
1868+
```
1869+
1870+
even before pandas 3.0 is available.
1871+
18241872
When you use chained indexing, the order and type of the indexing operation
18251873
partially determine whether the result is a slice into the original object, or
18261874
a copy of the slice.

doc/source/user_guide/timeseries.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ into ``freq`` keyword arguments. The available date offsets and associated frequ
882882
:class:`~pandas.tseries.offsets.BMonthBegin` or :class:`~pandas.tseries.offsets.BusinessMonthBegin`, ``'BMS'``, "business month begin"
883883
:class:`~pandas.tseries.offsets.CBMonthEnd` or :class:`~pandas.tseries.offsets.CustomBusinessMonthEnd`, ``'CBME'``, "custom business month end"
884884
:class:`~pandas.tseries.offsets.CBMonthBegin` or :class:`~pandas.tseries.offsets.CustomBusinessMonthBegin`, ``'CBMS'``, "custom business month begin"
885-
:class:`~pandas.tseries.offsets.SemiMonthEnd`, ``'SM'``, "15th (or other day_of_month) and calendar month end"
885+
:class:`~pandas.tseries.offsets.SemiMonthEnd`, ``'SME'``, "15th (or other day_of_month) and calendar month end"
886886
:class:`~pandas.tseries.offsets.SemiMonthBegin`, ``'SMS'``, "15th (or other day_of_month) and calendar month begin"
887887
:class:`~pandas.tseries.offsets.QuarterEnd`, ``'QE'``, "calendar quarter end"
888888
:class:`~pandas.tseries.offsets.QuarterBegin`, ``'QS'``, "calendar quarter begin"
@@ -1241,7 +1241,7 @@ frequencies. We will refer to these aliases as *offset aliases*.
12411241
"D", "calendar day frequency"
12421242
"W", "weekly frequency"
12431243
"ME", "month end frequency"
1244-
"SM", "semi-month end frequency (15th and end of month)"
1244+
"SME", "semi-month end frequency (15th and end of month)"
12451245
"BME", "business month end frequency"
12461246
"CBME", "custom business month end frequency"
12471247
"MS", "month start frequency"

doc/source/whatsnew/v0.19.0.rst

+10-6
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,13 @@ These provide date offsets anchored (by default) to the 15th and end of month, a
329329
330330
**SemiMonthEnd**:
331331

332-
.. ipython:: python
332+
.. code-block:: python
333333
334-
pd.Timestamp("2016-01-01") + SemiMonthEnd()
334+
In [46]: pd.Timestamp("2016-01-01") + SemiMonthEnd()
335+
Out[46]: Timestamp('2016-01-15 00:00:00')
335336
336-
pd.date_range("2015-01-01", freq="SM", periods=4)
337+
In [47]: pd.date_range("2015-01-01", freq="SM", periods=4)
338+
Out[47]: DatetimeIndex(['2015-01-15', '2015-01-31', '2015-02-15', '2015-02-28'], dtype='datetime64[ns]', freq='SM-15')
337339
338340
**SemiMonthBegin**:
339341

@@ -345,11 +347,13 @@ These provide date offsets anchored (by default) to the 15th and end of month, a
345347
346348
Using the anchoring suffix, you can also specify the day of month to use instead of the 15th.
347349

348-
.. ipython:: python
350+
.. code-block:: python
349351
350-
pd.date_range("2015-01-01", freq="SMS-16", periods=4)
352+
In [50]: pd.date_range("2015-01-01", freq="SMS-16", periods=4)
353+
Out[50]: DatetimeIndex(['2015-01-01', '2015-01-16', '2015-02-01', '2015-02-16'], dtype='datetime64[ns]', freq='SMS-16')
351354
352-
pd.date_range("2015-01-01", freq="SM-14", periods=4)
355+
In [51]: pd.date_range("2015-01-01", freq="SM-14", periods=4)
356+
Out[51]: DatetimeIndex(['2015-01-14', '2015-01-31', '2015-02-14', '2015-02-28'], dtype='datetime64[ns]', freq='SM-14')
353357
354358
.. _whatsnew_0190.enhancements.index:
355359

doc/source/whatsnew/v2.1.4.rst

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Fixed regressions
2222
Bug fixes
2323
~~~~~~~~~
2424
- Bug in :class:`Series` constructor raising DeprecationWarning when ``index`` is a list of :class:`Series` (:issue:`55228`)
25+
- Fixed bug in :meth:`DataFrame.__setitem__` casting :class:`Index` with object-dtype to PyArrow backed strings when ``infer_string`` option is set (:issue:`55638`)
26+
- Fixed bug in :meth:`Index.insert` casting object-dtype to PyArrow backed strings when ``infer_string`` option is set (:issue:`55638`)
2527
-
2628

2729
.. ---------------------------------------------------------------------------

doc/source/whatsnew/v2.2.0.rst

+17-5
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,17 @@ Other API changes
233233
Deprecations
234234
~~~~~~~~~~~~
235235

236-
Deprecate aliases ``M``, ``Q``, and ``Y`` in favour of ``ME``, ``QE``, and ``YE`` for offsets
237-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
236+
Deprecate aliases ``M``, ``SM``, ``BM``, ``CBM``, ``Q``, ``BQ``, and ``Y`` in favour of ``ME``, ``SME``, ``BME``, ``CBME``, ``QE``, ``BQE``, and ``YE`` for offsets
237+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
238238

239239
Deprecated the following frequency aliases (:issue:`9586`):
240240

241241
- ``M`` (month end) has been renamed ``ME`` for offsets
242+
- ``SM`` (semi month end) has been renamed ``SME`` for offsets
243+
- ``BM`` (business month end) has been renamed ``BME`` for offsets
244+
- ``CBM`` (custom business month end) has been renamed ``CBME`` for offsets
242245
- ``Q`` (quarter end) has been renamed ``QE`` for offsets
246+
- ``BQ`` (business quarter end) has been renamed ``BQE`` for offsets
243247
- ``Y`` (year end) has been renamed ``YE`` for offsets
244248

245249
For example:
@@ -266,7 +270,9 @@ Other Deprecations
266270
- Deprecated :func:`read_gbq` and :meth:`DataFrame.to_gbq`. Use ``pandas_gbq.read_gbq`` and ``pandas_gbq.to_gbq`` instead https://pandas-gbq.readthedocs.io/en/latest/api.html (:issue:`55525`)
267271
- Deprecated :meth:`.DataFrameGroupBy.fillna` and :meth:`.SeriesGroupBy.fillna`; use :meth:`.DataFrameGroupBy.ffill`, :meth:`.DataFrameGroupBy.bfill` for forward and backward filling or :meth:`.DataFrame.fillna` to fill with a single value (or the Series equivalents) (:issue:`55718`)
268272
- Deprecated :meth:`Index.format`, use ``index.astype(str)`` or ``index.map(formatter)`` instead (:issue:`55413`)
273+
- Deprecated ``core.internals`` members ``Block``, ``ExtensionBlock``, and ``DatetimeTZBlock``, use public APIs instead (:issue:`55139`)
269274
- Deprecated ``year``, ``month``, ``quarter``, ``day``, ``hour``, ``minute``, and ``second`` keywords in the :class:`PeriodIndex` constructor, use :meth:`PeriodIndex.from_fields` instead (:issue:`55960`)
275+
- Deprecated allowing non-integer ``periods`` argument in :func:`date_range`, :func:`timedelta_range`, :func:`period_range`, and :func:`interval_range` (:issue:`56036`)
270276
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_clipboard`. (:issue:`54229`)
271277
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_csv` except ``path_or_buf``. (:issue:`54229`)
272278
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_dict`. (:issue:`54229`)
@@ -285,13 +291,14 @@ Other Deprecations
285291
- Deprecated automatic downcasting of object-dtype results in :meth:`Series.replace` and :meth:`DataFrame.replace`, explicitly call ``result = result.infer_objects(copy=False)`` instead. To opt in to the future version, use ``pd.set_option("future.no_silent_downcasting", True)`` (:issue:`54710`)
286292
- Deprecated downcasting behavior in :meth:`Series.where`, :meth:`DataFrame.where`, :meth:`Series.mask`, :meth:`DataFrame.mask`, :meth:`Series.clip`, :meth:`DataFrame.clip`; in a future version these will not infer object-dtype columns to non-object dtype, or all-round floats to integer dtype. Call ``result.infer_objects(copy=False)`` on the result for object inference, or explicitly cast floats to ints. To opt in to the future version, use ``pd.set_option("future.no_silent_downcasting", True)`` (:issue:`53656`)
287293
- Deprecated including the groups in computations when using :meth:`DataFrameGroupBy.apply` and :meth:`DataFrameGroupBy.resample`; pass ``include_groups=False`` to exclude the groups (:issue:`7155`)
294+
- Deprecated indexing an :class:`Index` with a boolean indexer of length zero (:issue:`55820`)
288295
- Deprecated not passing a tuple to :class:`DataFrameGroupBy.get_group` or :class:`SeriesGroupBy.get_group` when grouping by a length-1 list-like (:issue:`25971`)
289296
- Deprecated string ``AS`` denoting frequency in :class:`YearBegin` and strings ``AS-DEC``, ``AS-JAN``, etc. denoting annual frequencies with various fiscal year starts (:issue:`54275`)
290297
- Deprecated string ``A`` denoting frequency in :class:`YearEnd` and strings ``A-DEC``, ``A-JAN``, etc. denoting annual frequencies with various fiscal year ends (:issue:`54275`)
291298
- Deprecated string ``BAS`` denoting frequency in :class:`BYearBegin` and strings ``BAS-DEC``, ``BAS-JAN``, etc. denoting annual frequencies with various fiscal year starts (:issue:`54275`)
292299
- Deprecated string ``BA`` denoting frequency in :class:`BYearEnd` and strings ``BA-DEC``, ``BA-JAN``, etc. denoting annual frequencies with various fiscal year ends (:issue:`54275`)
293300
- Deprecated string ``BQ`` denoting frequency in :class:`BQuarterEnd` (:issue:`52064`)
294-
- Deprecated strings ``BM``, and ``CBM`` denoting frequencies in :class:`BusinessMonthEnd`, :class:`CustomBusinessMonthEnd` (:issue:`52064`)
301+
- Deprecated strings ``BM``, ``CBM``, and ``SM`` denoting frequencies in :class:`BusinessMonthEnd`, :class:`CustomBusinessMonthEnd, :class:`SemiMonthEnd` (:issue:`52064`)
295302
- Deprecated strings ``H``, ``BH``, and ``CBH`` denoting frequencies in :class:`Hour`, :class:`BusinessHour`, :class:`CustomBusinessHour` (:issue:`52536`)
296303
- Deprecated strings ``H``, ``S``, ``U``, and ``N`` denoting units in :func:`to_timedelta` (:issue:`52536`)
297304
- Deprecated strings ``H``, ``T``, ``S``, ``L``, ``U``, and ``N`` denoting units in :class:`Timedelta` (:issue:`52536`)
@@ -312,10 +319,12 @@ Performance improvements
312319
~~~~~~~~~~~~~~~~~~~~~~~~
313320
- Performance improvement in :func:`.testing.assert_frame_equal` and :func:`.testing.assert_series_equal` (:issue:`55949`, :issue:`55971`)
314321
- Performance improvement in :func:`concat` with ``axis=1`` and objects with unaligned indexes (:issue:`55084`)
322+
- Performance improvement in :func:`get_dummies` (:issue:`56089`)
315323
- Performance improvement in :func:`merge_asof` when ``by`` is not ``None`` (:issue:`55580`, :issue:`55678`)
316324
- Performance improvement in :func:`read_stata` for files with many variables (:issue:`55515`)
317325
- Performance improvement in :func:`to_dict` on converting DataFrame to dictionary (:issue:`50990`)
318326
- Performance improvement in :meth:`DataFrame.groupby` when aggregating pyarrow timestamp and duration dtypes (:issue:`55031`)
327+
- Performance improvement in :meth:`DataFrame.loc` and :meth:`Series.loc` when indexing with a :class:`MultiIndex` (:issue:`56062`)
319328
- Performance improvement in :meth:`DataFrame.sort_index` and :meth:`Series.sort_index` when indexed by a :class:`MultiIndex` (:issue:`54835`)
320329
- Performance improvement in :meth:`Index.difference` (:issue:`55108`)
321330
- Performance improvement in :meth:`MultiIndex.get_indexer` when ``method`` is not ``None`` (:issue:`55839`)
@@ -359,6 +368,8 @@ Datetimelike
359368
- Bug in creating a :class:`Index`, :class:`Series`, or :class:`DataFrame` with a non-nanosecond :class:`DatetimeTZDtype` and inputs that would be out of bounds with nanosecond resolution incorrectly raising ``OutOfBoundsDatetime`` (:issue:`54620`)
360369
- Bug in creating a :class:`Index`, :class:`Series`, or :class:`DataFrame` with a non-nanosecond ``datetime64`` (or :class:`DatetimeTZDtype`) from mixed-numeric inputs treating those as nanoseconds instead of as multiples of the dtype's unit (which would happen with non-mixed numeric inputs) (:issue:`56004`)
361370
- Bug in creating a :class:`Index`, :class:`Series`, or :class:`DataFrame` with a non-nanosecond ``datetime64`` dtype and inputs that would be out of bounds for a ``datetime64[ns]`` incorrectly raising ``OutOfBoundsDatetime`` (:issue:`55756`)
371+
- Bug in parsing datetime strings with nanosecond resolution with non-ISO8601 formats incorrectly truncating sub-microsecond components (:issue:`56051`)
372+
- Bug in parsing datetime strings with sub-second resolution and trailing zeros incorrectly inferring second or millisecond resolution (:issue:`55737`)
362373
-
363374

364375
Timedelta
@@ -370,7 +381,7 @@ Timezones
370381
^^^^^^^^^
371382
- Bug in :class:`AbstractHolidayCalendar` where timezone data was not propagated when computing holiday observances (:issue:`54580`)
372383
- Bug in :class:`Timestamp` construction with an ambiguous value and a ``pytz`` timezone failing to raise ``pytz.AmbiguousTimeError`` (:issue:`55657`)
373-
-
384+
- Bug in :meth:`Timestamp.tz_localize` with ``nonexistent="shift_forward`` around UTC+0 during DST (:issue:`51501`)
374385

375386
Numeric
376387
^^^^^^^
@@ -459,10 +470,11 @@ Reshaping
459470
- Bug in :func:`merge` returning columns in incorrect order when left and/or right is empty (:issue:`51929`)
460471
- Bug in :meth:`pandas.DataFrame.melt` where an exception was raised if ``var_name`` was not a string (:issue:`55948`)
461472
- Bug in :meth:`pandas.DataFrame.melt` where it would not preserve the datetime (:issue:`55254`)
473+
- Bug in :meth:`pandas.DataFrame.pivot_table` where the row margin is incorrect when the columns have numeric names (:issue:`26568`)
462474

463475
Sparse
464476
^^^^^^
465-
-
477+
- Bug in :meth:`SparseArray.take` when using a different fill value than the array's fill value (:issue:`55181`)
466478
-
467479

468480
ExtensionArray

pandas/_libs/tslibs/conversion.pyx

+7-3
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz,
508508
npy_datetimestruct dts
509509
int out_local = 0, out_tzoffset = 0, string_to_dts_failed
510510
datetime dt
511-
int64_t ival
511+
int64_t ival, nanos = 0
512512
NPY_DATETIMEUNIT out_bestunit, reso
513513
_TSObject obj
514514

@@ -560,10 +560,14 @@ cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz,
560560
return obj
561561

562562
dt = parse_datetime_string(
563-
ts, dayfirst=dayfirst, yearfirst=yearfirst, out_bestunit=&out_bestunit
563+
ts,
564+
dayfirst=dayfirst,
565+
yearfirst=yearfirst,
566+
out_bestunit=&out_bestunit,
567+
nanos=&nanos,
564568
)
565569
reso = get_supported_reso(out_bestunit)
566-
return convert_datetime_to_tsobject(dt, tz, nanos=0, reso=reso)
570+
return convert_datetime_to_tsobject(dt, tz, nanos=nanos, reso=reso)
567571

568572
return convert_datetime_to_tsobject(dt, tz)
569573

pandas/_libs/tslibs/dtypes.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ OFFSET_TO_PERIOD_FREQSTR: dict = {
175175
"WEEKDAY": "D",
176176
"EOM": "M",
177177
"BME": "M",
178+
"SME": "M",
178179
"BQS": "Q",
179180
"QS": "Q",
180181
"BQE": "Q",
@@ -275,6 +276,7 @@ cdef dict c_OFFSET_DEPR_FREQSTR = {
275276
"A-NOV": "YE-NOV",
276277
"BM": "BME",
277278
"CBM": "CBME",
279+
"SM": "SME",
278280
"BQ": "BQE",
279281
"BQ-DEC": "BQE-DEC",
280282
"BQ-JAN": "BQE-JAN",
@@ -358,8 +360,6 @@ cdef dict c_DEPR_ABBREVS = {
358360
"BAS-SEP": "BYS-SEP",
359361
"BAS-OCT": "BYS-OCT",
360362
"BAS-NOV": "BYS-NOV",
361-
"BM": "BME",
362-
"CBM": "CBME",
363363
"H": "h",
364364
"BH": "bh",
365365
"CBH": "cbh",

pandas/_libs/tslibs/offsets.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,7 @@ cdef class SemiMonthEnd(SemiMonthOffset):
31293129
>>> pd.offsets.SemiMonthEnd().rollforward(ts)
31303130
Timestamp('2022-01-15 00:00:00')
31313131
"""
3132-
_prefix = "SM"
3132+
_prefix = "SME"
31333133
_min_day_of_month = 1
31343134

31353135
def is_on_offset(self, dt: datetime) -> bool:
@@ -4549,7 +4549,7 @@ prefix_mapping = {
45494549
MonthEnd, # 'ME'
45504550
MonthBegin, # 'MS'
45514551
Nano, # 'ns'
4552-
SemiMonthEnd, # 'SM'
4552+
SemiMonthEnd, # 'SME'
45534553
SemiMonthBegin, # 'SMS'
45544554
Week, # 'W'
45554555
Second, # 's'

pandas/_libs/tslibs/parsing.pxd

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from cpython.datetime cimport datetime
2+
from numpy cimport int64_t
23

34
from pandas._libs.tslibs.np_datetime cimport NPY_DATETIMEUNIT
45

@@ -10,5 +11,6 @@ cdef datetime parse_datetime_string(
1011
str date_string,
1112
bint dayfirst,
1213
bint yearfirst,
13-
NPY_DATETIMEUNIT* out_bestunit
14+
NPY_DATETIMEUNIT* out_bestunit,
15+
int64_t* nanos,
1416
)

0 commit comments

Comments
 (0)