-
Notifications
You must be signed in to change notification settings - Fork 121
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
FutureWarning: ChainedAssignmentError #894
Comments
My guess it that this warning is indeed a result from line 153 - pandas is sometimes overly careful with these future-warnings. Note that |
I also tried to print a line with data before and after reinstallation. It did not change:
And this also gives zeros:
If I'm not mistaken, Update Tried to create code:
Tests fail: How do you solve the duplicate problem in |
Correct.
You are creating a new IamDataFrame that has duplicate entries with the initial dataframe, so |
Need to try dumping the data into a dataframe, adding what you need, and converting it back to pyam.IamDataFrame. Just need to decide which columns are considered for duplicates, all except @danielhuppmann I did PR #900 but on
|
The duplicates are in the rows of |
I don't convert
and then convert it to pyam.IamDataFrame: What could be the problem here? Locally the test passes for me, it breaks in Actions py3.12. |
Tests are failing on py3.12 because on the latest supported version, we are using pytest-mpl to check that the generated figures are indeed as expected, see the Actions workflow pyam/.github/workflows/pytest.yml Line 74 in ebcf032
Figure created from your branch I'm not sure what exactly you are trying to do, but you are clearly changing the actual data used when generating the plot. Look at the test-readme for more info into running the tests with figure-comparison: https://github.com/IAMconsortium/pyam/blob/main/tests/README.md |
And as you said, pyam.IamDataFrame used to be like a pandas dataframe. In the tests, the data is changed and supplemented, if I understand correctly? That's why I don't convert the dataframe to pyam.IamDataFrame first, but I do what the code did in the past and only then convert the data to pyam.IamDataFrame. Thanks for the tip, I also found the commit where this was done. In my code, if I don’t change anything at all, the tests pass and the picture is the same:
then it is not at all clear what these lines do?:
|
I see several warnings (for example, here is one):
I wanted to fix this, but I can't find where exactly the chain indexing happens. It's clearly not on row
153,
but somewhere higher. Probably when generating the class with the data.I also tried (doesn't help):
df.data.loc[len(df.data) - 1, :] = newdata
Tried searching the
][
repository to find possible chain indexing. Printing data, but mostly it was dictionaries or in the end it didn't apply to the tests of interest.The text was updated successfully, but these errors were encountered: