diff --git a/optimas/utils/other.py b/optimas/utils/other.py index 29e56206..103993fc 100644 --- a/optimas/utils/other.py +++ b/optimas/utils/other.py @@ -48,7 +48,10 @@ def convert_to_dataframe( # Get fields in given data. if isinstance(data, np.ndarray): # Labels with multidimensional arrays are converted to a list of lists. - d = {label: data[label].tolist() for label in data.dtype.names} + d = { + label: data[label].tolist() if data[label].ndim > 1 else data[label] + for label in data.dtype.names + } return pd.DataFrame(d) elif isinstance(data, pd.DataFrame): return data