hgrecco / pint-pandas

Pandas support for pint
Other
166 stars 41 forks source link

Run tests with `force_ndarray_like = True` #190

Open andrewgsavage opened 1 year ago

andrewgsavage commented 1 year ago

Following https://github.com/hgrecco/pint-pandas/pull/187 , it would be good to run tests with force_ndarray_like = True

Need to find a way to get pytest to run the tests with this setting set to True and False, ideally without maintaining two files with the tests in.

andrewgsavage commented 1 year ago
Failed tests when setting force_ndarray_like = True FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_transform[float] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_transform[int] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_transform[complex128] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[scalar-float] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[scalar-int] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[scalar-complex128] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[list-float] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[list-int] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[list-complex128] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[series-float] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[series-int] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[series-complex128] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[object-float] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[object-int] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestGroupby::test_groupby_extension_apply[object-complex128] - TypeError: Series.name must be a hashable type FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_value_counts[data_missing-float-True] - TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any suppo... FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_value_counts[data_missing-float-False] - TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any suppo... FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_value_counts[data_missing-int-True] - TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any suppo... FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_value_counts[data_missing-int-False] - TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any suppo... FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_sort_values_frame[float-True] - TypeError: unhashable type: 'numpy.ndarray' FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_sort_values_frame[float-False] - TypeError: unhashable type: 'numpy.ndarray' FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_sort_values_frame[int-True] - TypeError: unhashable type: 'numpy.ndarray' FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_sort_values_frame[int-False] - TypeError: unhashable type: 'numpy.ndarray' FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_sort_values_frame[complex128-True] - TypeError: unhashable type: 'numpy.ndarray' FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_sort_values_frame[complex128-False] - TypeError: unhashable type: 'numpy.ndarray' FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_where_series[True-int] - AssertionError: DataFrame.iloc[:, 0] (column name="a") NA mask are different FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMethods::test_where_series[False-int] - AssertionError: Series NA mask are different FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMissing::test_fillna_series[float] - AssertionError: Series NA mask are different FAILED pint_pandas/testsuite/test_pandas_extensiontests.py::TestMissing::test_fillna_series[int] - AssertionError: Series NA mask are different
andrewgsavage commented 1 year ago

can make a pint-xarray installed, like is done for uncertainties and numpy in pint

and add


try:
    import pint_xarray
    _HAS_PINT_XARRAY = True
except ImportError:
    _HAS_PINT_XARRAY = False

to tests