Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dataset["dataset" + str(row + 1)][
"dimension"].update({"id": dim_names})
dataset["dataset" + str(row + 1)][
"dimension"].update({"size": [len(dims[i].unique())
for i in dims.columns.values]})
for category in categories:
dataset["dataset" + str(row + 1)][
"dimension"].update(category)
if output == 'list':
result.append(dataset)
elif output == 'dict':
result.update(dataset)
else:
result = None
return json.dumps(result, cls=NumpyEncoder)
def default(self, obj):
if isinstance(obj, np.integer) or isinstance(obj, np.int64):
return int(obj)
elif isinstance(obj, np.floating):
return float(obj)
elif isinstance(obj, np.ndarray):
return obj.tolist()
else:
return super(NumpyEncoder, self).default(obj)