@@ -490,8 +490,8 @@ def _serialise_value(
490490):
491491 # We can use a dictionary to map most numpy types to one of the types defined in the flatbuffer schema
492492 # but we have to handle strings separately as there are many subtypes
493- if np .issubdtype (value .dtype , np .unicode_ ) or np .issubdtype (
494- value .dtype , np .string_
493+ if np .issubdtype (value .dtype , np .str_ ) or np .issubdtype (
494+ value .dtype , np .bytes_
495495 ):
496496 string_serialiser (builder , value , source )
497497 else :
@@ -501,7 +501,7 @@ def _serialise_value(
501501 # There are a few numpy types we don't try to handle, for example complex numbers
502502 raise NotImplementedError (
503503 f"Cannot serialise data of type { value .dtype } , must use one of "
504- f"{ list (_map_scalar_type_to_serialiser .keys ()) + [np .unicode_ ]} "
504+ f"{ list (_map_scalar_type_to_serialiser .keys ()) + [np .str_ ]} "
505505 )
506506
507507
@@ -539,8 +539,8 @@ def _serialise_value(
539539
540540def _decode_if_scalar_string (value : np .ndarray ) -> Union [str , np .ndarray ]:
541541 if value .ndim == 0 and (
542- np .issubdtype (value .dtype , np .unicode_ )
543- or np .issubdtype (value .dtype , np .string_ )
542+ np .issubdtype (value .dtype , np .str_ )
543+ or np .issubdtype (value .dtype , np .bytes_ )
544544 ):
545545 return value .item ().decode ()
546546 return value
0 commit comments