I have a numpy array of datetime64, and I would like to round off the sub-second values of the array elements. E.g., from 2001-1-1 10:33:32.5 to 2001-1-1 10:33:32.0. I am looking for a vecotrized method.
More generally, I am looking for a vectorized method to round to any frequency (minutes, days, etc.).
rounded = numpy.array(myarray, dtype='datetime64[s]')orrounded = myarray.astype('datetime64[s]')This also works for minutes by using: