dimod
dimod copied to clipboard
`SampleSet.to_pandas_dataframe` fails for record arrays with fields of more than one dimension
https://github.com/dwavesystems/dimod/pull/963 was an attempt to fix this issue, but that approach fails. More investigation needed.
Failing examples
samples = dimod.SampleSet(
np.rec.array([([0.], 1., 1, True, [])],
dtype=[('sample', '<f8', (1,)), ('energy', '<f8'),
('num_occurrences', '<i4'), ('thing1', '?'),
('thing2', '?', (0,))]),
['a'], {}, 'INTEGER')
samples = dimod.SampleSet(
np.rec.array([([0.], 1., 1, True, []), [([0.], 1., 1, True, []), [([0.], 1., 1, True, [])],
dtype=[('sample', '<f8', (1,)), ('energy', '<f8'),
('num_occurrences', '<i4'), ('thing1', '?'),
('thing2', '?', (0,))]),
['a'], {}, 'INTEGER')
Note that pandas.DataFrame.from_records also fails for this case with Exception: Data must be 1-dimensional.