i have the below posted list and it contais lists, so it is a list of lists, and i have a webservice that returns return jsonify(resultsDict)
. the problem i am facing is when i run the App i recieve either of the error messages posted below.
as shown in the code below, i tried to set dtype=np.float64
and dtype=object
, but each of them generates an error associated to it as shown below in the code.
please let me know how to fix it
attempt_1
resultsDict={
"extras": {
"pvTreatment":np.array(pvTreatment,dtype=np.float64).tolist(),
...
...
...
}
}
**error associated**:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (7,) + inhomogeneous part.
attempt_2
resultsDict = {
"extras": {
"pvTreatment":np.array(pvTreatment,dtype=object).tolist(),
...
...
...
}
}
**error associated**:
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type float32 is not JSON serializable