Skip to content

DataFrameSchema with column of type pa.Float will raise SchemaError on validating DataFrame with float32 column #525

@daavidstein

Description

@daavidstein

Bug description
DataFrameSchema with column of type pandera.Float will raise SchemaError on validating DataFrame with float32 column

Minimal Failing Example

schema = DataFrameSchema(

    columns={
        "A": Column(
              pa.Float,
        ),

    },
)
df =pd.DataFrame({"A":[0.1]}, dtype="float32")
schema.validate(df)
#SchemaError: expected series 'A' to have type 'float64', got 'float32'

Expected behavior

Given that the pandera documentation states that pandera.Float corresponds to numpy float the expectation is that a SchemaError is not raised for columns with type float16, float32, float64, or float128

Additional context

Our dataset columns go through a transformation from float128 to float32 and we would like to use the same schema for validation before and after the transformation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions