Wednesday, 11 May 2022

Pandas 1.4.2 upgrade casuing FFlask: array(0.78015261) (0d array) is not JSON serializable at the moment

We upgraded to a newer version of python with new pandas, numpy, etc. The versions are now:

- python=3.10.4
- pandas=1.4.2
- numpy=1.22.3

In previous versions, the error never occurred. When I do some debugging, it's not that the .to_json() is wrong or fails, it's that the pd.DataFrame([my_result]) doesn't return correctly.

The code is this:

// Used in debugging and doesn't return properly
dataframe_test = pd.DataFrame([my_result])

// Error gets thrown here
return pd.DataFrame([my_result]).to_json()

The dataframe_test looks like this when I go to view it in Data Viewer within VS Code (it also keeps processing as the data seems to still be running in VS Code - the bar above the viewer is indicating that its still trying to run/process):

enter image description here

The my_result variable looks like this upon entering the dataframe:

enter image description here

enter image description here

I am not sure what exactly is causing the issue and not sure how to debug in Pandas to see what is happening. Any ideas?



from Pandas 1.4.2 upgrade casuing FFlask: array(0.78015261) (0d array) is not JSON serializable at the moment

No comments:

Post a Comment