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

ValueError in .add_year.interpolate_2d() with pandas 1.4.0 #559

Closed
LauWien opened this issue Feb 9, 2022 · 3 comments · Fixed by #557
Closed

ValueError in .add_year.interpolate_2d() with pandas 1.4.0 #559

LauWien opened this issue Feb 9, 2022 · 3 comments · Fixed by #557
Assignees
Labels
bug Doesn't work as advertised/unintended effects ci Continuous integration
Milestone

Comments

@LauWien
Copy link
Contributor

LauWien commented Feb 9, 2022

The tests test_add_year.py::test_add_year_cli and test_add_year.py::test_add_year start to fail seemingly randomly in various PRs on different OS e.g. here. Looking deeper, failing test are using pandas==1.4.0, passing tests are using e.g. pandas==1.1.5. With upgrading pandas to 1.4.0 locally these errors can be replicated, while with version 1.1.5 the test succeed.

@LauWien LauWien added the ci Continuous integration label Feb 9, 2022
@LauWien LauWien self-assigned this Feb 9, 2022
@khaeru
Copy link
Member

khaeru commented Feb 9, 2022

The fundamental cause here is code that's not compatible with current pandas; the failing CI is only a symptom. The offending lines are:

df2_t[yr].loc[cond1 & cond2] = intpol(
df2_t[year_pre], df2_t[year_pp], year_pre, year_pp, yr
)

ValueError: cannot set using a list-like indexer with a different length than the value

NB #494 was started to simplify these very long methods that mostly duplicate upstream features and are also quite slow, but I lacked clear tests for the expected behaviour for some combinations of arguments.

@LauWien
Copy link
Contributor Author

LauWien commented Feb 9, 2022

The fundamental cause here is code that's not compatible with current pandas;

Yes, was already checking where and how to adapt the code. Thank you for linking the PR!

@khaeru khaeru changed the title Address failing tests in CI ValueError in .add_year.interpolate_2d() with pandas 1.4.0 Feb 10, 2022
@khaeru khaeru added the bug Doesn't work as advertised/unintended effects label Feb 10, 2022
@khaeru khaeru added this to the 3.5 milestone Feb 10, 2022
@khaeru khaeru linked a pull request Feb 23, 2022 that will close this issue
5 tasks
@khaeru
Copy link
Member

khaeru commented Feb 23, 2022

#557 (comment)

It looks like there were several regressions related to pd.DataFrame.loc fixed in pandas 1.4.1: https://pandas.pydata.org/pandas-docs/stable/whatsnew/v1.4.1.html#fixed-regressions.

i.e. perhaps this is only with pandas 1.4.0 precisely.

@LauWien LauWien linked a pull request Feb 23, 2022 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Doesn't work as advertised/unintended effects ci Continuous integration
Projects
None yet
2 participants