Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into cln/isin/datelike
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed May 16, 2024
2 parents 43c3bc4 + 4fb94bb commit 6f9ec8e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
3 changes: 2 additions & 1 deletion doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Removal of prior version deprecations/changes
- :func:`read_excel`, :func:`read_json`, :func:`read_html`, and :func:`read_xml` no longer accept raw string or byte representation of the data. That type of data must be wrapped in a :py:class:`StringIO` or :py:class:`BytesIO` (:issue:`53767`)
- :func:`to_datetime` with a ``unit`` specified no longer parses strings into floats, instead parses them the same way as without ``unit`` (:issue:`50735`)
- :meth:`DataFrame.groupby` with ``as_index=False`` and aggregation methods will no longer exclude from the result the groupings that do not arise from the input (:issue:`49519`)
- :meth:`ExtensionArray._reduce` now requires a ``keepdims: bool = False`` parameter in the signature (:issue:`52788`)
- :meth:`Series.dt.to_pydatetime` now returns a :class:`Series` of :py:class:`datetime.datetime` objects (:issue:`52459`)
- :meth:`SeriesGroupBy.agg` no longer pins the name of the group to the input passed to the provided ``func`` (:issue:`51703`)
- All arguments except ``name`` in :meth:`Index.rename` are now keyword only (:issue:`56493`)
Expand Down Expand Up @@ -462,6 +463,7 @@ Plotting

Groupby/resample/rolling
^^^^^^^^^^^^^^^^^^^^^^^^
- Bug in :meth:`.DataFrameGroupBy.__len__` and :meth:`.SeriesGroupBy.__len__` would raise when the grouping contained NA values and ``dropna=False`` (:issue:`58644`)
- Bug in :meth:`.DataFrameGroupBy.groups` and :meth:`.SeriesGroupby.groups` that would not respect groupby argument ``dropna`` (:issue:`55919`)
- Bug in :meth:`.DataFrameGroupBy.median` where nat values gave an incorrect result. (:issue:`57926`)
- Bug in :meth:`.DataFrameGroupBy.quantile` when ``interpolation="nearest"`` is inconsistent with :meth:`DataFrame.quantile` (:issue:`47942`)
Expand All @@ -470,7 +472,6 @@ Groupby/resample/rolling
- Bug in :meth:`DataFrameGroupBy.apply` that was returning a completely empty DataFrame when all return values of ``func`` were ``None`` instead of returning an empty DataFrame with the original columns and dtypes. (:issue:`57775`)
- Bug in :meth:`DataFrameGroupBy.apply` with ``as_index=False`` that was returning :class:`MultiIndex` instead of returning :class:`Index`. (:issue:`58291`)
- Bug in :meth:`DataFrameGroupby.transform` and :meth:`SeriesGroupby.transform` with a reducer and ``observed=False`` that coerces dtype to float when there are unobserved categories. (:issue:`55326`)
- Bug in :meth:`.DataFrameGroupBy.__len__` and :meth:`.SeriesGroupBy.__len__` would raise when the grouping contained NA values and ``dropna=False`` (:issue:`58644`)


Reshaping
Expand Down
6 changes: 0 additions & 6 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1933,12 +1933,6 @@ def _reduce(
keepdims : bool, default False
If False, a scalar is returned.
If True, the result has dimension with size one along the reduced axis.
.. versionadded:: 2.1
This parameter is not required in the _reduce signature to keep backward
compatibility, but will become required in the future. If the parameter
is not found in the method signature, a FutureWarning will be emitted.
**kwargs
Additional keyword arguments passed to the reduction function.
Currently, `ddof` is the only supported kwarg.
Expand Down
20 changes: 1 addition & 19 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
Sequence,
)
import functools
from inspect import signature
from io import StringIO
import itertools
import operator
Expand Down Expand Up @@ -11408,28 +11407,11 @@ def func(values: np.ndarray):
# We only use this in the case that operates on self.values
return op(values, axis=axis, skipna=skipna, **kwds)

dtype_has_keepdims: dict[ExtensionDtype, bool] = {}

def blk_func(values, axis: Axis = 1):
if isinstance(values, ExtensionArray):
if not is_1d_only_ea_dtype(values.dtype):
return values._reduce(name, axis=1, skipna=skipna, **kwds)
has_keepdims = dtype_has_keepdims.get(values.dtype)
if has_keepdims is None:
sign = signature(values._reduce)
has_keepdims = "keepdims" in sign.parameters
dtype_has_keepdims[values.dtype] = has_keepdims
if has_keepdims:
return values._reduce(name, skipna=skipna, keepdims=True, **kwds)
else:
warnings.warn(
f"{type(values)}._reduce will require a `keepdims` parameter "
"in the future",
FutureWarning,
stacklevel=find_stack_level(),
)
result = values._reduce(name, skipna=skipna, **kwds)
return np.array([result])
return values._reduce(name, skipna=skipna, keepdims=True, **kwds)
else:
return op(values, axis=axis, skipna=skipna, **kwds)

Expand Down
4 changes: 2 additions & 2 deletions pandas/io/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def read_orc(
.. versionadded:: 2.0
filesystem : fsspec or pyarrow filesystem, default None
Filesystem object to use when reading the parquet file.
Filesystem object to use when reading the orc file.
.. versionadded:: 2.1.0
Expand All @@ -99,7 +99,7 @@ def read_orc(
--------
>>> result = pd.read_orc("example_pa.orc") # doctest: +SKIP
"""
# we require a newer version of pyarrow than we support for parquet
# we require a newer version of pyarrow than we support for orc

orc = import_optional_dependency("pyarrow.orc")

Expand Down

0 comments on commit 6f9ec8e

Please sign in to comment.