ValueError :Setting an array element with a sequence using numpy
问题 I have this piece of code in python data = np.empty(temp.shape) maxlat = temp.shape[0] maxlon = temp.shape[1] print(maxlat,maxlon) for i in range(0,maxlat) : for j in range(0,maxlon): data[i][j] = p_temperature(pr,temp[i][j]) When I run this code in Python 3.5, I get this error ValueError : setting an array element with a sequence The value of maxlat is 181 and the value of maxlon is 360 . The shape of temp array is (181,360) I also tried the suggestion in the comments: for i in range(0