From 6296f4afecb45ca114afc72253409269bc45228b Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 1 Nov 2023 18:10:54 -0400 Subject: [PATCH] Refinements --- pandas/core/groupby/ops.py | 2 +- pandas/tests/groupby/aggregate/test_other.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/groupby/ops.py b/pandas/core/groupby/ops.py index e2e9be685bcc9..a2df7887b1be2 100644 --- a/pandas/core/groupby/ops.py +++ b/pandas/core/groupby/ops.py @@ -769,9 +769,9 @@ def result_index_and_ids(self) -> tuple[Index, np.ndarray]: codes = [e[0] for e in codes_and_uniques] levels = [e[1] for e in codes_and_uniques] - # TODO: Modify in Grouping.groups instead? for k, (ping, level) in enumerate(zip(self.groupings, levels)): if ping._passed_categorical: + # TODO: Modify in Grouping.groups instead? # set_categories is dynamically added levels[k] = level.set_categories( # type: ignore[union-attr] ping._orig_cats diff --git a/pandas/tests/groupby/aggregate/test_other.py b/pandas/tests/groupby/aggregate/test_other.py index a5021bf72662c..8f0f14e1d02af 100644 --- a/pandas/tests/groupby/aggregate/test_other.py +++ b/pandas/tests/groupby/aggregate/test_other.py @@ -513,8 +513,8 @@ def test_agg_timezone_round_trip(): def test_sum_uint64_overflow(): - # see gh-14758 - # Convert to uint64 and don't overflow + # GH#14758 + # Don't coerce object to more specific dtype df = DataFrame([[1, 2], [3, 4], [5, 6]], dtype=object) df = df + 9223372036854775807