Is there something similar to Python's numpy.apply_along_axis in Javascript?

I need to translate a Python program to Javascript and I see numpy.apply_along_axis many times, but don't know how to do it in Javascript. Please, help!

+3


source to share


1 answer


There are various ideas on how to create "multidimensional arrays" in Javascript in this SO question a few years ago

JavaScript multidimensional array

Basically everyone uses nested arrays, equivalent to Python's nested lists.

You have to have some kind of multidimensional array in order to have the concept of an "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

Creating a multidimensional array script

Packages like underscore.js

and lodash

have iterators and array / collection functions that make it easier to work with arrays. There are, for example, functions zip

and flatten

.

https://lodash.com/docs

0


source







All Articles