def preprocess_writing(key, value):
if isinstance(value, dict):
# hack for storing dicts
value = np.array([str(value)])
else:
value = np.array(value)
if value.ndim == 0:
value = np.array([value])
# some output about the data to write
logg.m(key, type(value),
value.dtype, value.dtype.kind, value.shape,
v=6)
# make sure string format is chosen correctly
if value.dtype.kind == 'U':
value = value.astype(np.string_)
return key, value
评论列表
文章目录