I’m trying to make some code run faster by using pypy. However, whenever I run the code using pypy, I get an error from pypy‘s numpy equivalent (numpypy).
In my usual code I use…
numpy.average(array, axis=0)
in order to average an array along a particular axis.
When running the same code using pypy and numpypy, I get the following error:
TypeError: average() got an unexpected keyword argument 'axis'
I could use a for loop to go through the array and average individual elements but this would take a long time and (I would imagine) not provide the speed that I would like.
Is there an alternative to numpy.average() that can average along an axis whilst using numpypy?
If you don’t need to use the
weightsparameter, you can usemeaninstead (1.9.1-dev0 — not sure when it was introduced):