File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -143,14 +143,22 @@ def _get_value(hdf_node):
143143 if hdf_value .dtype .kind in "iufc" :
144144 return hdf_value
145145 if len (hdf_value .shape ) > 0 :
146+ # Variable-length UTF-8 / object arrays
147+ if hdf_value .dtype .kind == "O" :
148+ # Recursively decode nested lists if needed
149+ def decode_array (arr ):
150+ result = []
151+ for x in arr :
152+ if isinstance (x , (np .ndarray , list )):
153+ result .append (decode_array (x ))
154+ else :
155+ result .append (str (decode_or_not (x )))
156+ return result
146157
147- def recurse (x ):
148- if hasattr (x , "shape" ) and len (x .shape ) > 0 :
149- return [recurse (i ) for i in x ]
150- else :
151- return str (decode_or_not (x ))
158+ return decode_array (hdf_value )
152159
153- return str (recurse (hdf_value ))
160+ # Fallback for other arrays
161+ return str ([i for i in hdf_value .astype (str )])
154162
155163 return hdf_node [()].decode ()
156164
You can’t perform that action at this time.
0 commit comments