pandera icon indicating copy to clipboard operation
pandera copied to clipboard

pandera not compatible with numpy 2.0

Open ostetzer opened this issue 1 year ago • 2 comments

Pandera seems to be incompatible with the neweset version of numpy 2.0: When defining a simple class based on DataFrameModel, the following error occurs duing import:

... from pandera.engines import numpy_engine, pandas_engine ... AttributeError: np.string_ was removed in the NumPy 2.0 release. Use np.bytes_ instead.. Did you mean: 'strings'?

A clear and concise description of what the bug is.

  • [ x] I have checked that this issue has not already been reported.
  • [x ] I have confirmed this bug exists on the latest version of pandera.

Expected behavior

Pandera should work with newest numpy version 2.0

Desktop (please complete the following information):

  • OS: Windows
  • Python: 3.11
  • Numpy: 2.0
  • Pandas: 2.2.2
  • Pandera: 0.19.3

ostetzer avatar May 23 '24 08:05 ostetzer

hi @ostetzer I see numpy 2 is finally in beta as a release candidate!

Can you share the schema that's raising this error?

cosmicBboy avatar May 23 '24 12:05 cosmicBboy

from pandera import Field, DataFrameModel
from pandera.typing import Series


class TimeSeriesData(DataFrameModel):
    time_data: Series[float]
    sensor_data: Series[float]

As mentioned above, the error occurs already during import (import numpy_engine, pandas_engine)

ostetzer avatar May 23 '24 12:05 ostetzer