This seems to be a bug.
For me, array concatenation is not working as expected. Doing a little searching, I found these:
Those links show projects adapting to an intentional change of behavior that happened back in numpy 1.12, after a deprecation period. As far as I can tell, though, none of them have anything to do with array concatenation.
Can you give an example of what you're doing and what you're getting and what you were expecting instead?
Sure. This is the whole script:
import numpy as np
import scipy.io.wavfile as wf
(fs, x) = wf.read('wave.wav')
zrs = np.zeros(int(x.size / 2))
x = np.concatenate(x, zrs)
Thank you very much for the help!
Concatenate's signature is
def concatenate(arrays, axis=0):
i.e. it takes a single positional argument which is an iterable of arrays to be concatenated. So you want np.concatenate((x, zrs))
. Right now you're ending up saying np.concatenate(x, axis=zrs)
, and then numpy is getting confused when it tries to convert the zrs
array into an axis index.
Hi Nathaniel,
Thank you for that. Sorry to waste your time on a silly syntax mistake. You are very kind to have answered. :)
Most helpful comment
Concatenate's signature is
i.e. it takes a single positional argument which is an iterable of arrays to be concatenated. So you want
np.concatenate((x, zrs))
. Right now you're ending up sayingnp.concatenate(x, axis=zrs)
, and then numpy is getting confused when it tries to convert thezrs
array into an axis index.