Skip to content

Commit 6d5c78a

Browse files
Use isnull from pandas objects to capture pd.NA too
1 parent f0f8d83 commit 6d5c78a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pymc3/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1695,10 +1695,10 @@ def pandas_to_array(data):
16951695
XXX: When `data` is a generator, this will return a Theano tensor!
16961696
16971697
"""
1698-
if hasattr(data, "to_numpy"):
1698+
if hasattr(data, "to_numpy") and hasattr(data, "isnull"):
16991699
# typically, but not limited to pandas objects
17001700
vals = data.to_numpy()
1701-
mask = np.isnan(vals)
1701+
mask = data.isnull().to_numpy()
17021702
if mask.any():
17031703
# there are missing values
17041704
ret = np.ma.MaskedArray(vals, mask)

0 commit comments

Comments
 (0)