I have a spectrogram. It's 129 rows x n columns. I want to "cut" the columns to 20. And I would do something like this:
if spectrogram.shape[1] > 20:
for row in spectrogram:
i = spectrogram.index(row)
row = row[:20]
spectrogram[i] = row
But it throws out an error using .index(), so I tried using .where() as I saw here on SOF but another error occurred:
AttributeError: 'numpy.ndarray' object has no attribute 'where'
How should I do?
spectrogram[:, :20]