Skip to content

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
@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!

Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants