equinor / fmu-ensemble

Python objectification of reservoir model ensembles left on disk by ERT.
GNU General Public License v3.0
12 stars 19 forks source link

Compatibility with pandas 1.5.0 #223

Closed berland closed 2 years ago

berland commented 2 years ago

When bumping from pandas 1.4.3 to 1.5.0, the following test fail:

tests/test_realization.py::test_status_load FAILED                                                                                                                                                                       [ 14%]

=========================================================================================================== FAILURES ===========================================================================================================
_______________________________________________________________________________________________________ test_status_load _______________________________________________________________________________________________________

tmpdir = local('/tmp/pytest-of-havb/pytest-122/test_status_load0')

    def test_status_load(tmpdir):
        """Test loading of STATUS file with different errors in them

        These files are custom text files, and can have stray error
        messages in them. Robustness (i.e. no crash) is more
        important than best-effort parsing. Better parsing
        is left for issue #12
        """

        # Mock a realization:
        tmpdir.join("realization-0").mkdir()

        # Test with some selected STATUS files:
        with open(str(tmpdir.join("realization-0/STATUS")), "w") as status_fh:
            status_fh.write("")
>       real = ensemble.ScratchRealization(str(tmpdir.join("realization-0")))

/work/projects/fmu-ensemble/tests/test_realization.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/work/projects/fmu-ensemble/src/fmu/ensemble/realization.py:154: in __init__
    self.load_status()
/work/projects/fmu-ensemble/src/fmu/ensemble/realization.py:528: in load_status
    status.loc[errorjobs, "errorstring"] = (
/work/venv/new/lib64/python3.8/site-packages/pandas/core/indexing.py:819: in __setitem__
    iloc._setitem_with_indexer(indexer, value, self.name)
/work/venv/new/lib64/python3.8/site-packages/pandas/core/indexing.py:1723: in _setitem_with_indexer
    self.obj[key] = value
/work/venv/new/lib64/python3.8/site-packages/pandas/core/frame.py:3968: in __setitem__
    self._set_item_frame_value(key, value)

...[snip]....
        if len(value.columns) != 1:
>           raise ValueError(
                "Cannot set a DataFrame with multiple columns to the single "
                f"column {key}"
            )
E           ValueError: Cannot set a DataFrame with multiple columns to the single column errorstring

/work/venv/new/lib64/python3.8/site-packages/pandas/core/frame.py:4123: ValueError