Skip to content

Commit c37f7d1

Browse files
committed
Fixed numpy bool serialization to msgpack
This allows for running to_msgpack with dataframes containing field of numpy.bool_ datatype
1 parent 103ea6f commit c37f7d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/io/msgpack/_packer.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from libc.limits cimport *
88

99
from pandas.io.msgpack.exceptions import PackValueError
1010
from pandas.io.msgpack import ExtType
11+
from numpy import bool_
1112

1213

1314
cdef extern from "../../src/msgpack/pack.h":
@@ -133,7 +134,7 @@ cdef class Packer(object):
133134
while True:
134135
if o is None:
135136
ret = msgpack_pack_nil(&self.pk)
136-
elif isinstance(o, bool):
137+
elif isinstance(o, (bool, bool_)):
137138
if o:
138139
ret = msgpack_pack_true(&self.pk)
139140
else:

0 commit comments

Comments
 (0)