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

Float Nullability if Entire Column None #1695

Open
3 tasks done
typkrft opened this issue Jun 19, 2024 · 1 comment
Open
3 tasks done

Float Nullability if Entire Column None #1695

typkrft opened this issue Jun 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@typkrft
Copy link

typkrft commented Jun 19, 2024

Describe the bug
It seems that if all the values for a dataframe column are None, nullability throws an error. Not sure if theres a reason for this, or I am doing something wrong.

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandera.
  • (optional) I have confirmed this bug exists on the main branch of pandera.

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas as pd 
import pandera as pa

df = pd.DataFrame({"test": [None, 1.1, None]})
df1=pd.DataFrame({"test": [None, None, None]})
schema = pa.DataFrameSchema(
    {"test": pa.Column(float, nullable=True)}
)
schema.validate(df)
print(df)
schema.validate(df1)
print(df1)

Expected behavior

I would expect the check to pass.

Desktop (please complete the following information):

  • OS: [e.g. iOS] macOS 14.0 (23A344)
  • Version: 0.19.3
@typkrft typkrft added the bug Something isn't working label Jun 19, 2024
@typkrft
Copy link
Author

typkrft commented Jun 19, 2024

setting dtype=None in pa.Column seems to circumvent this, or explicitly setting the dtype in the dataframe prior to running validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant