get an i8 representation of datetime values:
>>> date_bins_i8 = date_bins.view('i8') >>> np.digitize(date_bins_i8, date_bins_i8) array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
i8 is a 64-bit integer data type, and view creates an idea of ββthe memory of the array.
source share