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

test_summary will fail in Pandas3 #520

Open
berland opened this issue Jan 17, 2025 · 1 comment
Open

test_summary will fail in Pandas3 #520

berland opened this issue Jan 17, 2025 · 1 comment

Comments

@berland
Copy link
Collaborator

berland commented Jan 17, 2025

In Pandas3 the tests will not pass due to:

    def test_df2ressum(dframe):
        """Test that a dataframe can be converted to a summary object, and then read
        back again"""
    
        # Massage the dframe first so we can assert on equivalence after.
        dframe = _fix_dframe_for_resdata(dframe)
    
        summary = df2ressum(dframe)
        if dframe.empty:
            assert summary is None
            return
    
        dframe_roundtrip = df(summary)
>       pd.testing.assert_frame_equal(
            dframe.sort_index(axis=1),
            dframe_roundtrip.sort_index(axis=1),
            check_dtype=False,
        )

tests/test_summary.py:1037: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

left = Index([2016-01-01 00:00:00], dtype='object', name='DATE'), right = DatetimeIndex(['2016-01-01'], dtype='datetime64[us]', name='DATE', freq=None), obj = 'DataFrame.index'

    def _check_types(left, right, obj: str = "Index") -> None:
        if not exact:
            return
    
>       assert_class_equal(left, right, exact=exact, obj=obj)
E       AssertionError: DataFrame.index are different
E       
E       DataFrame.index classes are different
E       [left]:  Index([2016-01-01 00:00:00], dtype='object', name='DATE')
E       [right]: DatetimeIndex(['2016-01-01'], dtype='datetime64[us]', name='DATE', freq=None)

/data/venv/venv/lib64/python3.11/site-packages/pandas/_testing/asserters.py:245: AssertionError
======================================================================================= short test summary info =======================================================================================
FAILED tests/test_summary.py::test_df2ressum[dframe1] - AssertionError: DataFrame.index are different
@berland berland changed the title test_summary will fail in Pandas 3.0.0 test_summary will fail in Pandas3 Jan 17, 2025
@berland
Copy link
Collaborator Author

berland commented Jan 17, 2025

This is related to a FutureWarning that Pandas 2.2.3 is emitting:

/data/venv/venv/lib64/python3.11/site-packages/pandas/core/indexes/base.py:7588: FutureWarning: Dtype inference on a pandas object (Series, Index, ExtensionArray) is deprecated. The Index constructor will keep the original dtype in the future. Call `infer_objects` on the result to get the old behavior.
  return Index(sequences[0], name=names)

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

No branches or pull requests

1 participant