Skip to content

GH1246 Upgrade to pandas 2.3.0 #1247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

loicdiridollou
Copy link
Member

"DataFrameGroupBy.apply operated on the grouping columns.",
upper="2.2.99",
),
pytest_warns_bounded(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite annoying that they changed the type of warning that was raised but guess we don't have too much choice than doubling the context manager to grab the warnings.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are testing with 2.3, so you only need to test for FutureWarning with upper="2.3.99"

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jun 10, 2025

/pandas_nightly

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also run locally poe pytest --nightly to see that these changes will work with the development version of pandas?

I tried to do /pandas_nightly but it didn't seem to run

@@ -50,6 +50,7 @@

TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING
WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower()
PD_LTE_23 = Version(pd.__version__) < Version("2.3.999")
PD_LTE_22 = Version(pd.__version__) < Version("2.2.999")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should remove the PD_LTE_22

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

"DataFrameGroupBy.apply operated on the grouping columns.",
upper="2.2.99",
),
pytest_warns_bounded(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are testing with 2.3, so you only need to test for FutureWarning with upper="2.3.99"

Comment on lines 3471 to 3476
with (
pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.apply operated on the grouping columns.",
upper="2.2.99",
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

pytest_warns_bounded(
FutureWarning,
"DataFrameGroupBy.apply operated on the grouping columns.",
lower="2.2.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to 2.3.99

Comment on lines 3488 to 3499
with (
pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.apply operated on the grouping columns.",
upper="2.2.99",
),
pytest_warns_bounded(
FutureWarning,
"DataFrameGroupBy.apply operated on the grouping columns.",
lower="2.2.99",
upper="2.3.99",
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment - just leave in the 2.3 test since that is all we are testing against

Comment on lines 4430 to 4434
DeprecationWarning,
msg,
lower="2.2.99",
upper="2.2.99",
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since no warning is issued with 2.3, we can just leave out the context manager

Comment on lines 81 to 90
pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
upper="2.2.99",
),
pytest_warns_bounded(
FutureWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only include the FutureWarning

Comment on lines 135 to 146
with (
pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
upper="2.2.99",
),
pytest_warns_bounded(
FutureWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
lower="2.2.99",
upper="2.3.99",
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 192 to 201
pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
upper="2.2.99",
),
pytest_warns_bounded(
FutureWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 216 to 227
with (
pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
upper="2.2.99",
),
pytest_warns_bounded(
FutureWarning,
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
lower="2.2.99",
upper="2.3.99",
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jun 10, 2025

actually the nightly run did happen. So make sure it is OK as well. See https://github.com/pandas-dev/pandas-stubs/actions/runs/15561066263/job/43813216242

@loicdiridollou
Copy link
Member Author

/pandas_nightly

@loicdiridollou
Copy link
Member Author

https://github.com/pandas-dev/pandas-stubs/actions/runs/15586088519
Pandas nightly is good now too

@loicdiridollou loicdiridollou requested a review from Dr-Irv June 11, 2025 13:43
Comment on lines 1545 to 1559
with pytest_warns_bounded(
FutureWarning,
"(The provided callable <built-in function sum> is currently using|The behavior of DataFrame.sum with)",
upper="2.2.99",
):
with pytest_warns_bounded(
DeprecationWarning,
"DataFrameGroupBy.apply operated on the grouping columns",
upper="2.2.99",
):
if PD_LTE_22:
check(
assert_type(df.groupby(by="col1").apply(sum), pd.DataFrame),
pd.DataFrame,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test needs to remain, but use 2 FutureWarning with upper="2.3.99" and have a check on PD_LTE_23

Comment on lines 3437 to 3438
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

Comment on lines 3449 to 3450
lower="2.2.99",
upper="2.99.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

Comment on lines 3460 to 3461
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

Comment on lines 3471 to 3472
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

msg = "The copy keyword is deprecated and will be removed in a future"
with pytest_warns_bounded(
DeprecationWarning,
msg,
lower="2.2.99",
lower="2.3.99",
upper="3.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the upper here.

Comment on lines 83 to 84
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

Comment on lines 131 to 132
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

Comment on lines 180 to 181
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

Comment on lines 198 to 199
lower="2.2.99",
upper="2.3.99",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this at upper="2.99"

@loicdiridollou
Copy link
Member Author

/pandas_nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to pandas 2.3.0
2 participants