0

I have a dict of arrays like these:

gen = {0: [array([0])], 1: [array([1]), array([-1])]}

and I would like to save them with msgpack:

import msgpack

with open('data.msgpack', 'wb') as file:
    msgpack.pack(gen, file)

But it returns the error:

TypeError: can't serialize array([0])

What is the problem?

SuperCiocia
  • 1,823
  • 6
  • 23
  • 40

1 Answers1

0

i do not have the reputation to comment, but you don't need to initialize an array using 'array', Just using [ ] is enough.

Said that, you can see a similar code posted by a user here

lucas_7_94
  • 326
  • 3
  • 9