To create e.g. x-axis indices you can use the linspace function from numpy.
You give it a range (e.g. 0 to 23) and the number of divisions and it will distribute the values evenly across that range. The stop values is included in the resulting value array by default.
Example:
import numpy as np
np.linspace(0, 23, num=9)
0: 0.000 1: 2.875 2: 5.750 3: 8.625 4: 11.500 5: 14.375 6: 17.250 7: 20.125 8: 23.000
Read more about numpy: