Skip to content

Commit

Permalink
Pickles instead of fails when saving np.object
Browse files Browse the repository at this point in the history
Fixes #23.
  • Loading branch information
gustavla committed Nov 15, 2016
1 parent fca42af commit 43be9ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deepdish/io/hdf5io.py
Expand Up @@ -19,7 +19,7 @@

from deepdish import six

IO_VERSION = 11
IO_VERSION = 12
DEEPDISH_IO_PREFIX = 'DEEPDISH_IO'
DEEPDISH_IO_VERSION_STR = DEEPDISH_IO_PREFIX + '_VERSION'
DEEPDISH_IO_UNPACK = DEEPDISH_IO_PREFIX + '_DEEPDISH_IO_UNPACK'
Expand Down Expand Up @@ -121,6 +121,10 @@ def _save_ndarray(handler, group, name, x, filters=None):
strtype = b'ascii'
itemsize = x.itemsize
atom = tables.StringAtom(itemsize)
elif x.dtype == np.object:
# Not supported by HDF5, force pickling
_save_pickled(handler, group, x, name=name)
return
else:
atom = tables.Atom.from_dtype(x.dtype)
strtype = None
Expand Down

0 comments on commit 43be9ed

Please sign in to comment.