You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using pickle to save schematas, there currently is no guarantee even for minor releases to be compatible. As an example, run the following file twice, once with pandas 0.14.5, once with 0.15.1.
When attempting to unpickle and apply the schema saved with 0.14.5 with 0.15.1, the following error is thrown:
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/api/pandas/container.py", line 410, in __call__
return self.validate(
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/api/pandas/container.py", line 341, in validate
return self._validate(
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/api/pandas/container.py", line 371, in _validate
return self.get_backend(check_obj).validate(
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/backends/pandas/container.py", line 98, in validate
results = check(*args) # type: ignore [operator]
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/backends/pandas/container.py", line 146, in run_schema_component_checks
result = schema_component.validate(
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/api/pandas/components.py", line 161, in validate
return self.get_backend(check_obj).validate(
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/backends/pandas/components.py", line 98, in validate
validate_column(check_obj, column_name)
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/backends/pandas/components.py", line 57, in validate_column
super(ColumnBackend, self).validate(
File "/opt/homebrew/Caskroom/miniforge/base/envs/flow-venv-3.9-conda/lib/python3.9/site-packages/pandera/backends/pandas/array.py", line 49, in validate
if pd.notna(schema.default):
AttributeError: 'Column' object has no attribute 'default'
`
``
- [ 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.
- [ x ] (optional) I have confirmed this bug exists on the master branch of pandera.
```python
import glob
import pickle as pkl
import pandera as pda
import pandas as pd
x = pd.DataFrame({"A": [1,2,3]})
s = pda.DataFrameSchema({"A": pda.Column(pda.Int, nullable=True)})
with open(f"schema_{pda.__version__}.pkl", "wb") as f:
pkl.dump(s, f)
for pth in glob.glob("schema*.pkl"):
print(pth)
with open(pth, "rb") as f:
s2 = pkl.load(f)
s2(x)
Expected behavior
Script runs through with both versions.
Desktop (please complete the following information):
OS: MacOS
Version: 0.15.1
The text was updated successfully, but these errors were encountered:
@Zahlii this was an attribute added in Release 0.15, I've opened a small PR to check this attribute exists before calling it. This should fix your issue!
Describe the bug
When using pickle to save schematas, there currently is no guarantee even for minor releases to be compatible. As an example, run the following file twice, once with pandas 0.14.5, once with 0.15.1.
When attempting to unpickle and apply the schema saved with 0.14.5 with 0.15.1, the following error is thrown:
Expected behavior
Script runs through with both versions.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: