Skip to content

failing tests with pandas 2.1 #8125

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

Closed
dcherian opened this issue Aug 31, 2023 · 10 comments · Fixed by #8139
Closed

failing tests with pandas 2.1 #8125

dcherian opened this issue Aug 31, 2023 · 10 comments · Fixed by #8139
Labels

Comments

@dcherian
Copy link
Contributor

dcherian commented Aug 31, 2023

What happened?

See #8101

FAILED xarray/tests/test_missing.py::test_interpolate_pd_compat - ValueError: 'fill_value' is not a valid keyword for DataFrame.interpolate
FAILED xarray/tests/test_missing.py::test_interpolate_pd_compat_non_uniform_index - ValueError: 'fill_value' is not a valid keyword for DataFrame.interpolate

and this doctest

FAILED xarray/core/dataarray.py::xarray.core.dataarray.DataArray.to_unstacked_dataset

@pydata/xarray can someone take a look please?

@dcherian dcherian added bug needs triage Issue that has not been reviewed by xarray team member and removed needs triage Issue that has not been reviewed by xarray team member labels Aug 31, 2023
@kmuehlbauer
Copy link
Contributor

kmuehlbauer commented Aug 31, 2023

FAILED xarray/tests/test_missing.py::test_interpolate_pd_compat - ValueError: 'fill_value' is not a valid keyword for DataFrame.interpolate
FAILED xarray/tests/test_missing.py::test_interpolate_pd_compat_non_uniform_index - ValueError: 'fill_value' is not a valid keyword for DataFrame.interpolate

fill_value - kwarg was removed upstream and raises error now -> pandas-dev/pandas#53962

To me it looks like fill_value should have only been removed for ["ffill", "bfill", "pad", "backfill"] - methods.

@kmuehlbauer
Copy link
Contributor

kmuehlbauer commented Aug 31, 2023

FAILED xarray/core/dataarray.py::xarray.core.dataarray.DataArray.to_unstacked_dataset

The doctest works for me locally, investigating package differences in the environment now.

Update:

OK, it does run, but I get a different result (after to_stacked_array):

MultiIndex([('a',   0),
            ('a',   1),
            ('a',   2),
            ('b', nan)],
           name='z')

instead of

MultiIndex([('a', 0.0),
            ('a', 1.0),
            ('a', 2.0),
            ('b', nan)],
           name='z')

@mathause
Copy link
Collaborator

mathause commented Aug 31, 2023

I think the doctest failure is unrelated to the removal of fill_value. I think this is pandas avoiding the cast of int to float when the nan value is added. The cheap solution is to convert the ints to floats

-         ...     coords=[("x", ["a", "b"]), ("y", [0, 1, 2])], 
+         ...     coords=[("x", ["a", "b"]), ("y", [0., 1, 2])],

in

... coords=[("x", ["a", "b"]), ("y", [0, 1, 2])],

@kmuehlbauer
Copy link
Contributor

kmuehlbauer commented Sep 1, 2023

I've opened pandas-dev/pandas#54920 upstream for the fill_value-issue.

@kmuehlbauer
Copy link
Contributor

Upstream is already working on a fix for the fill_value-issue: pandas-dev/pandas#54927

@kmuehlbauer
Copy link
Contributor

Reopening until doc-test is fixed.

@benbovy
Copy link
Member

benbovy commented Sep 5, 2023

There are also two pandas-related warnings when building the docs, which cause a "failure" for PR builds on RTD:

/home/docs/checkouts/readthedocs.org/user_builds/xray/conda/8142/lib/python3.10/site-packages/pandas/core/indexes/base.py:docstring of pandas.core.indexes.base.Index.join:14: WARNING: Inline literal start-string without end-string.
/home/docs/checkouts/readthedocs.org/user_builds/xray/conda/8142/lib/python3.10/site-packages/pandas/core/indexes/base.py:docstring of pandas.core.indexes.base.Index.join:15: WARNING: Inline literal start-string without end-string.

Not sure how to (temporarily) fix those, though.

@max-sixty
Copy link
Collaborator

Reopening until doc-test is fixed.

Thanks (sorry this was an auto-close by GH, I hadn't meant to have it closed)

@kmuehlbauer
Copy link
Contributor

No worries @max-sixty, that just happens. It would be great, if we could fine grain closing issues. :-)

@kmuehlbauer
Copy link
Contributor

remaining things tracked in #8146

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

Successfully merging a pull request may close this issue.

5 participants