Describe the bug
When field is set as nullable, calling example() is more than ten times slower. I believe there is no reason for this.
[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.
[ ] (optional) I have confirmed this bug exists on the master branch of pandera.
Code Sample, a copy-pastable example
from timeit import timeit
import pandera as pa
import pandera.typing as pt
class MyDF1(pa.SchemaModel):
a: pt.Series[float]
class MyDF2(pa.SchemaModel):
a: pt.Series[float] = pa.Field(nullable=True)
# following command prints about 0.22 seconds on my computer
timeit('MyDF1.example(size=1)', setup='from __main__ import MyDF1', number=10)
# following command prints about 3.14 seconds on my computer
timeit('MyDF2.example(size=1)', setup='from __main__ import MyDF2', number=10)
Expected behavior
Both commands should take about the same time.
Desktop (please complete the following information):
Describe the bug When field is set as nullable, calling
example()
is more than ten times slower. I believe there is no reason for this.Code Sample, a copy-pastable example
Expected behavior
Both commands should take about the same time.
Desktop (please complete the following information):