Skip to content
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

[test][python] fix pandas DeprecationWarning about is_sparse function #6532

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

StrikerRUS
Copy link
Collaborator

Fix the following error:

DeprecationWarning: is_sparse is deprecated and will be removed in a future version. Check `isinstance(dtype, pd.SparseDtype)` instead.

LightGBM requires pandas>=0.24.0

pandas = [
"pandas>=0.24.0"
]

So I checked that pd.SparseDtype is available in that version:
https://pandas.pydata.org/pandas-docs/version/0.24/reference/api/pandas.SparseDtype.html

Also, they've been performing isinstance check under the hood since the begging:
https://github.com/pandas-dev/pandas/blob/83eb2428ceb6257042173582f3f436c2c887aa69/pandas/core/dtypes/common.py#L216-L219

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

And thank you for the research. We do now also have CI jobs testing against the oldest versions of Python dependencies:

test-oldest-versions:

and the latest (even pre-released) versions:

test-latest-versions:

@jameslamb jameslamb merged commit cd4459a into master Jul 10, 2024
41 checks passed
@jameslamb jameslamb deleted the pandas-sparse branch July 10, 2024 16:20
@StrikerRUS
Copy link
Collaborator Author

We do now also have CI jobs testing against the oldest versions of Python dependencies

Thank you for letting me know! That's great!

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

Successfully merging this pull request may close these issues.

2 participants