Run visualization having pandas Series as classes attributes (not JSON serializable)

11 views
Skip to first unread message

giacomo....@gmail.com

unread,
Oct 13, 2020, 2:06:43 PM10/13/20
to ProjectMesa
Hi! 
I'm developing a model in which I set some attributes of the agents and of the model as pandas Series (I opted for this type since I have to read many data and many operations took less lines of code for Series than for dictionaries).
However, when I got to the point of running the model launching the server to run the web visualization, I got the error that Series objects are not JSON serializable. 

I'd have two question:
  1. Is it possible to run the visualization even if I have some attributes that are pandas Series, or there is no way and I have to change them for dictionaries?
  2. In case I need to change for dictionaries, do I have to change only classes attributes or I cannot use any pandas Series/DataFrame at all, not even as temporary variables inside methods? 
I do not know JavaScript at all, sorry if I asked something trivial.
Thanks!
Reply all
Reply to author
Forward
0 new messages