-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
base: main
Are you sure you want to change the base?
GH1246 Upgrade to pandas 2.3.0 #1247
Conversation
tests/test_frame.py
Outdated
"DataFrameGroupBy.apply operated on the grouping columns.", | ||
upper="2.2.99", | ||
), | ||
pytest_warns_bounded( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
/pandas_nightly |
There was a problem hiding this 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
tests/__init__.py
Outdated
@@ -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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
tests/test_frame.py
Outdated
"DataFrameGroupBy.apply operated on the grouping columns.", | ||
upper="2.2.99", | ||
), | ||
pytest_warns_bounded( |
There was a problem hiding this comment.
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"
tests/test_frame.py
Outdated
with ( | ||
pytest_warns_bounded( | ||
DeprecationWarning, | ||
"DataFrameGroupBy.apply operated on the grouping columns.", | ||
upper="2.2.99", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
tests/test_frame.py
Outdated
pytest_warns_bounded( | ||
FutureWarning, | ||
"DataFrameGroupBy.apply operated on the grouping columns.", | ||
lower="2.2.99", |
There was a problem hiding this comment.
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
tests/test_frame.py
Outdated
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", | ||
), |
There was a problem hiding this comment.
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
tests/test_frame.py
Outdated
DeprecationWarning, | ||
msg, | ||
lower="2.2.99", | ||
upper="2.2.99", | ||
): |
There was a problem hiding this comment.
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
tests/test_groupby.py
Outdated
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only include the FutureWarning
tests/test_groupby.py
Outdated
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", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
tests/test_groupby.py
Outdated
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
tests/test_groupby.py
Outdated
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", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
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 |
/pandas_nightly |
https://github.com/pandas-dev/pandas-stubs/actions/runs/15586088519 |
tests/test_frame.py
Outdated
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, | ||
) |
There was a problem hiding this comment.
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
tests/test_frame.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
tests/test_frame.py
Outdated
lower="2.2.99", | ||
upper="2.99.99", |
There was a problem hiding this comment.
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"
tests/test_frame.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
tests/test_frame.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
tests/test_frame.py
Outdated
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the upper
here.
tests/test_groupby.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
tests/test_groupby.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
tests/test_groupby.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
tests/test_groupby.py
Outdated
lower="2.2.99", | ||
upper="2.3.99", |
There was a problem hiding this comment.
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"
/pandas_nightly |
assert_type()
to assert the type of any return value