-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
ENH Checks pandas and polars directly #28195
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
Conversation
|
Do you recall why we were ducktyping in the first place? |
It was an evolution of how we detect dataframes. It started with def _is_pandas_df(X):
if hasattr(X, "iloc"):
try:
import pandas as pd
return isinstance(X, pd.DataFrame)
except ImportError:
return False
return FalseBut there was overhead with importing pandas when pandas was installed, but not used. Then we shifted to getting the pandas module from |
doc/whats_new/v1.4.rst
Outdated
| larger than the number of non-duplicate samples. | ||
| :pr:`28165` by :user:`Jérémie du Boisberranger <jeremiedbb>`. | ||
|
|
||
| - |Fix| Pandas and Polars dataframe are validated directly without ducktyping checks. |
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.
I would not consider it a fix :) but rather an enhancement :)
glemaitre
left a comment
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.
LGTM. Thanks @thomasjpfan
OmarManzoor
left a comment
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.
LGTM. Thanks @thomasjpfan
Reference Issues/PRs
Fixes #28174
What does this implement/fix? Explain your changes.
This PR goes with the solution in #28174 (comment) .
There is no additional overhead because the pandas check is only used if it is in
sys.modules. It is insys.modulesonly if pandas is already imported by the user.