I want to remove all row that is all zero. I followed this question (as well as this) and tried the code directly in cmd, it worked well. But when I run the code from the file in cmd >python myfile.py
, it does not work.
The code is only
import numpy as np
aaa = np.zeros(shape=(2,4))
print aaa
aaa[~np.all(aaa == 0, axis=1)]
print aaa
Nothing is removed. I got exactly same array between two print. Why is it not working via the file?