Using Numpy, how can i produce an array that looks like this:
array(['1940', '1950', '1960', '1970', '1980', '1990', '2000', '2010', '2020'], dtype='datetime64[Y]')
Using Numpy, how can i produce an array that looks like this:
array(['1940', '1950', '1960', '1970', '1980', '1990', '2000', '2010', '2020'], dtype='datetime64[Y]')
import numpy
numpy.arange(numpy.datetime64("1940"), numpy.datetime64("2030"), numpy.timedelta64(10, "Y"), dtype='datetime64[Y]')
Take a look at https://numpy.org/doc/stable/reference/generated/numpy.arange.html for how to use numpy.arange().
Also, look at https://numpy.org/doc/stable/reference/arrays.datetime.html?highlight=datetime64 for how to use numpy.datetime64 and numpy.timedelta64.