IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
236 stars 120 forks source link

Column type casting based on values #881

Open quant12345 opened 1 month ago

quant12345 commented 1 month ago

Please confirm that this PR has done the following:

Description of PR

This PR removes the warnings:

FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas.

Before the changes I tried to print the column type before and after and everywhere it was float64 first and after setting the values ​​the column became of the object type. Since everywhere the values ​​imply a string value I set the object type.

tests to check:

pytest tests/test_core.py::test_init_df_with_illegal_values_raises
pytest tests/test_feature_validation.py
pytest tests/test_plotting.py::test_scatter_variables_with_meta_color
pytest tests/test_statistics.py::test_statistics
pytest tests/test_statistics.py::test_statistics_by_filter
pytest tests/test_statistics.py::test_statistics_with_rows