Python: replacing an element in an array without changing array shape -
i need replace of letters in array below letter 'k'. every time use numpy.replace
, numpy.delete
changes shape of array. there way can change selected letter in array without changing array shape?
aa = [['a', 'b', 'c']] aa = np.array(aa) aa = np.repeat(aa, 5, axis=0) aa = np.delete(aa, (1)) aa = np.insert(aa, (1), 'k')
i want able replace of letters in let array 'k'.
is there easy way this?
i'm not clear on trying accomplish , how imagine things turn out.
you start out 5 x 3 array , delete 1 element have 14 elements. shape did imagine in?
maybe want direct assignment
aa[1,2]='k'
Comments
Post a Comment