TypeError: Object of type ndarray is not JSON serializable
import numpy as np
import codecs, json
a = np.arange(10).reshape(2,5) # a 2 by 5 array
b = a.tolist() # nested lists with same data, indices
file_path = "/path.json" ## your path variable
json.dump(b, codecs.open(file_path, 'w', encoding='utf-8'), separators=(',', ':'), sort_keys=True, indent=4) ### this saves the array in .json format
Also in JavaScript:
- js convert nodelist to array
- The "chunk" argument must be one of type string or Buffer. Received type object nodejs
- print element by xpath javascript
- return only specific attributes when making query mongoose
- how to add up all the numbers in between 0 and that number
- react router url params
- js check if is array
- aos
- hello
- fetch data from external url nodejs
- loopback order by limit
- htmlWebpackPlugin.options.title
- site completo com ajax jquery
- how to implement redis pub sub model using nodejs
- json deep dot
- js reverse
- jquery get padding of element
- check if a variable is undefined jquery
- tranary operator in js
- how to display current date and time in angular
- find label jquery
- how to print in java script
- mongodb js get id of inserted
- check if 2 arrays are equal javascript