Closed FranziskHeeg closed 1 week ago
Seems json
cannot encode numpy
values. See https://stackoverflow.com/questions/50916422/python-typeerror-object-of-type-int64-is-not-json-serializable
Solution:
import json
import numpy as np
class NpEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
if isinstance(obj, np.floating):
return float(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
return super(NpEncoder, self).default(obj)
# Your codes ....
json.dumps(data, cls=NpEncoder)
Plot function for temporal networks is not working, when network is created by
pp.TemporalGraph.from_edge_list()
with timestamps and nodes as integers.This works:
This does not work:
This works again: