Index out of bounds (Python)
问题 I have some data that I would like to aggregate, but I'm getting the index out of bounds error, and I can't seem to figure out why. Here's my code: if period == "hour": n=3 tvec_a=np.zeros([24,6]) tvec_a[:,3]=np.arange(0,24) data_a=np.zeros([24,4]) elif period == "day": n=2 tvec_a=np.zeros([31,6]) tvec_a[:,2]=np.arange(1,32) data_a=np.zeros([31,4]) elif period == "month": n=1 tvec_a=np.zeros([12,6]) tvec_a[:,1]=np.arange(1,13) data_a=np.zeros([12,4]) elif period == "hour of the day": tvec_a