I need to translate a Python program into Javascript and I see numpy.apply_along_axis many times but do not know how to do that in Javascript. Please help!
There various ideas of how to create 'multidimensional arrays' in Javascript in this SO question from a few years back
JavaScript multidimensional array
Basically all use nested arrays, the equivalent of Python nested lists.
You have to have some sort of multidimensional array to have a concept of 'axis'. Inevitably some operations will be easier on the first level array than on the deepest level. And there will be speed penalties.
And for a syntax that looks more like Python, consider Coffeescript
Coffee script multidimensional array creation
Packages like underscore.js
and lodash
have array/collection iterators and functions that can make operation on arrays easier. There are, for example, zip
and flatten
functions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.