Skip to content

Commit e27b02e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ref/read_csv/cln
2 parents 9129675 + ad09dc6 commit e27b02e

Some content is hidden

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

42 files changed

+537
-675
lines changed

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
141141

142142
- name: Build wheels
143-
uses: pypa/[email protected].1
143+
uses: pypa/[email protected].2
144144
with:
145145
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
146146
env:

asv_bench/benchmarks/indexing.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,24 +546,17 @@ def time_chained_indexing(self, mode):
546546

547547

548548
class Block:
549-
params = [
550-
(True, "True"),
551-
(np.array(True), "np.array(True)"),
552-
]
553-
554-
def setup(self, true_value, mode):
549+
def setup(self):
555550
self.df = DataFrame(
556551
False,
557552
columns=np.arange(500).astype(str),
558553
index=date_range("2010-01-01", "2011-01-01"),
559554
)
560555

561-
self.true_value = true_value
562-
563-
def time_test(self, true_value, mode):
556+
def time_test(self):
564557
start = datetime(2010, 5, 1)
565558
end = datetime(2010, 9, 1)
566-
self.df.loc[start:end, :] = true_value
559+
self.df.loc[start:end, :] = True
567560

568561

569562
from .pandas_vb_common import setup # noqa: F401 isort:skip

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9595
-i "pandas.Period.freq GL08" \
9696
-i "pandas.Period.freqstr SA01" \
9797
-i "pandas.Period.month SA01" \
98-
-i "pandas.Period.now SA01" \
9998
-i "pandas.Period.ordinal GL08" \
10099
-i "pandas.Period.strftime PR01,SA01" \
101100
-i "pandas.Period.to_timestamp SA01" \

doc/source/user_guide/categorical.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ Assigning a ``Categorical`` to parts of a column of other types will use the val
793793
:okwarning:
794794
795795
df = pd.DataFrame({"a": [1, 1, 1, 1, 1], "b": ["a", "a", "a", "a", "a"]})
796-
df.loc[1:2, "a"] = pd.Categorical(["b", "b"], categories=["a", "b"])
796+
df.loc[1:2, "a"] = pd.Categorical([2, 2], categories=[2, 3])
797797
df.loc[2:3, "b"] = pd.Categorical(["b", "b"], categories=["a", "b"])
798798
df
799799
df.dtypes

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Other enhancements
4242
- :func:`DataFrame.to_excel` argument ``merge_cells`` now accepts a value of ``"columns"`` to only merge :class:`MultiIndex` column header header cells (:issue:`35384`)
4343
- :meth:`DataFrame.corrwith` now accepts ``min_periods`` as optional arguments, as in :meth:`DataFrame.corr` and :meth:`Series.corr` (:issue:`9490`)
4444
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
45+
- :meth:`DataFrame.ewm` now allows ``adjust=False`` when ``times`` is provided (:issue:`54328`)
4546
- :meth:`DataFrame.fillna` and :meth:`Series.fillna` can now accept ``value=None``; for non-object dtype the corresponding NA value will be used (:issue:`57723`)
4647
- :meth:`DataFrame.pivot_table` and :func:`pivot_table` now allow the passing of keyword arguments to ``aggfunc`` through ``**kwargs`` (:issue:`57884`)
4748
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
@@ -360,6 +361,7 @@ Other Removals
360361
- Changed the default value of ``na_action`` in :meth:`Categorical.map` to ``None`` (:issue:`51645`)
361362
- Changed the default value of ``observed`` in :meth:`DataFrame.groupby` and :meth:`Series.groupby` to ``True`` (:issue:`51811`)
362363
- Enforce deprecation in :func:`testing.assert_series_equal` and :func:`testing.assert_frame_equal` with object dtype and mismatched null-like values, which are now considered not-equal (:issue:`18463`)
364+
- Enforce banning of upcasting in in-place setitem-like operations (:issue:`59007`) (see `PDEP6 <https://pandas.pydata.org/pdeps/0006-ban-upcasting.html>`_)
363365
- Enforced deprecation ``all`` and ``any`` reductions with ``datetime64``, :class:`DatetimeTZDtype`, and :class:`PeriodDtype` dtypes (:issue:`58029`)
364366
- Enforced deprecation disallowing ``float`` "periods" in :func:`date_range`, :func:`period_range`, :func:`timedelta_range`, :func:`interval_range`, (:issue:`56036`)
365367
- Enforced deprecation disallowing parsing datetimes with mixed time zones unless user passes ``utc=True`` to :func:`to_datetime` (:issue:`57275`)
@@ -502,6 +504,7 @@ Datetimelike
502504
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)
503505
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` returning ``False`` on double-digit frequencies (:issue:`58523`)
504506
- Bug in :meth:`DatetimeIndex.union` when ``unit`` was non-nanosecond (:issue:`59036`)
507+
- Bug in :meth:`Series.dt.microsecond` producing incorrect results for pyarrow backed :class:`Series`. (:issue:`59154`)
505508
- Bug in setting scalar values with mismatched resolution into arrays with non-nanosecond ``datetime64``, ``timedelta64`` or :class:`DatetimeTZDtype` incorrectly truncating those scalars (:issue:`56410`)
506509

507510
Timedelta

pandas/_libs/tslibs/nattype.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ default 'raise'
15161516

15171517
See Also
15181518
--------
1519-
Timestamp.asm8 : Return numpy datetime64 format in nanoseconds.
1519+
Timestamp.asm8 : Return numpy datetime64 format with same precision.
15201520
Timestamp.to_pydatetime : Convert Timestamp object to a native
15211521
Python datetime object.
15221522
to_timedelta : Convert argument into timedelta object,

pandas/_libs/tslibs/period.pyx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,11 +2472,24 @@ cdef class _Period(PeriodMixin):
24722472
"""
24732473
Return the period of now's date.
24742474
2475+
The `now` method provides a convenient way to generate a period
2476+
object for the current date and time. This can be particularly
2477+
useful in financial and economic analysis, where data is often
2478+
collected and analyzed in regular intervals (e.g., hourly, daily,
2479+
monthly). By specifying the frequency, users can create periods
2480+
that match the granularity of their data.
2481+
24752482
Parameters
24762483
----------
24772484
freq : str, BaseOffset
24782485
Frequency to use for the returned period.
24792486
2487+
See Also
2488+
--------
2489+
to_datetime : Convert argument to datetime.
2490+
Period : Represents a period of time.
2491+
Period.to_timestamp : Return the Timestamp representation of the Period.
2492+
24802493
Examples
24812494
--------
24822495
>>> pd.Period.now('h') # doctest: +SKIP

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ cdef class _Timestamp(ABCTimestamp):
11391139
11401140
See Also
11411141
--------
1142-
Timestamp.asm8 : Return numpy datetime64 format in nanoseconds.
1142+
Timestamp.asm8 : Return numpy datetime64 format with same precision.
11431143
Timestamp.to_pydatetime : Convert Timestamp object to a native
11441144
Python datetime object.
11451145
to_timedelta : Convert argument into timedelta object,
@@ -1170,7 +1170,7 @@ cdef class _Timestamp(ABCTimestamp):
11701170
@property
11711171
def asm8(self) -> np.datetime64:
11721172
"""
1173-
Return numpy datetime64 format in nanoseconds.
1173+
Return numpy datetime64 format with same precision.
11741174

11751175
See Also
11761176
--------

pandas/_libs/window/aggregations.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,9 @@ def ewm(const float64_t[:] vals, const int64_t[:] start, const int64_t[:] end,
18131813
if normalize:
18141814
# avoid numerical errors on constant series
18151815
if weighted != cur:
1816+
if not adjust and com == 1:
1817+
# update in case of irregular-interval series
1818+
new_wt = 1. - old_wt
18161819
weighted = old_wt * weighted + new_wt * cur
18171820
weighted /= (old_wt + new_wt)
18181821
if adjust:

pandas/core/arrays/arrow/array.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,10 @@ def _dt_days_in_month(self) -> Self:
27942794

27952795
@property
27962796
def _dt_microsecond(self) -> Self:
2797-
return type(self)(pc.microsecond(self._pa_array))
2797+
# GH 59154
2798+
us = pc.microsecond(self._pa_array)
2799+
ms_to_us = pc.multiply(pc.millisecond(self._pa_array), 1000)
2800+
return type(self)(pc.add(us, ms_to_us))
27982801

27992802
@property
28002803
def _dt_minute(self) -> Self:

0 commit comments

Comments
 (0)