Repository navigation
add warning for pandas sparse Dataframe in check_array - #16021
Conversation
|
The added test fails and gives |
Linux pylatest_pip_openblas_pandas passes this test. |
|
This bug was fixed in numpy/numpy#5710. |
|
Is there a pd 0.23 equivalent of I suppose I'm fine with having this feature limited to recent Pandas |
|
I'm not sure if there's a method that'll work that far back.
…On Tue, Jan 7, 2020 at 11:59 PM Joel Nothman ***@***.***> wrote:
Is there a pd 0.23 equivalent of pd.api.types.is_sparse, @TomAugspurger
<https://github.com/TomAugspurger>?
I suppose I'm fine with having this feature limited to recent Pandas
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16021?email_source=notifications&email_token=AAKAOISJNKI73DJ2C2RHMBLQ4VTTFA5CNFSM4KCVGE42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEILI25A#issuecomment-571903348>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOIXX3P7QG4G5PFO4GGDQ4VTTFANCNFSM4KCVGE4Q>
.
|
|
Can somebody please guide me to get rid of these failing |
thomasjpfan
left a comment
There was a problem hiding this comment.
Thank you for the PR @rushabh-v !
thomasjpfan
left a comment
There was a problem hiding this comment.
Thank you for the PR @rushabh-v !
| from pandas.api.types import is_sparse | ||
| if array.dtypes.apply(is_sparse).any(): | ||
| warnings.warn( | ||
| "pandas Dataframe having sparse columns found." |
There was a problem hiding this comment.
| "pandas Dataframe having sparse columns found." | |
| "pandas.DataFrame having sparse columns found." |
| if array.dtypes.apply(is_sparse).any(): | ||
| warnings.warn( | ||
| "pandas Dataframe having sparse columns found." | ||
| "It will be inflated automatically." |
There was a problem hiding this comment.
Is "inflated" the formal term? We may use "densified" elsewhere
There was a problem hiding this comment.
I have used "densified" there now.
|
@jnothman Can you review it again for the changes you requested, please? |
|
I don't think another review from me us needed. Please await another core developer's review. Thanks |
rth
left a comment
There was a problem hiding this comment.
A few comments, otherwise LGTM thanks!
| - |Enhancement| improve error message in :func:`utils.validation.column_or_1d`. | ||
| :pr:`15926` by :user:`Loïc Estève <lesteve>`. | ||
| - |Enhancement| add warning in :func:`utils.validation.check_array` for | ||
| pandas sparse Dataframe. |
There was a problem hiding this comment.
| pandas sparse Dataframe. | |
| pandas sparse DataFrame. |
| pd = pytest.importorskip('pandas') | ||
| # restrict the pd versions < '0.24.0' as they have a bug in is_sparse func | ||
| if LooseVersion(pd.__version__) < '0.24.0': | ||
| return |
There was a problem hiding this comment.
| return | |
| pytest.skip(reason="pandas 0.24+ required.") |
| from pandas.api.types import is_sparse | ||
| if array.dtypes.apply(is_sparse).any(): | ||
| warnings.warn( | ||
| "pandas.DataFrame having sparse columns found." |
There was a problem hiding this comment.
| "pandas.DataFrame having sparse columns found." | |
| "pandas.DataFrame with sparse columns found." |
| if array.dtypes.apply(is_sparse).any(): | ||
| warnings.warn( | ||
| "pandas.DataFrame having sparse columns found." | ||
| "It will be densified automatically." |
There was a problem hiding this comment.
| "It will be densified automatically." | |
| "It will be converted to a dense numpy array." |
There was a problem hiding this comment.
Made all the changes
Fixes #15976