Using the pandas.date_range(startdate, periods=n, freq=f)
function you can create a range of pandas Timestamp
objects where the freq
optional paramter denotes the frequency (second, minute, hour, day...) in the range.
The documentation does not mention the literals that are expected to be passed in, but after a few minutes you can easily find most of them.
- 's' : second
- 'min' : minute
- 'H' : hour
- 'D' : day
- 'w' : week
- 'm' : month
However, none of 'y', 'Y', 'yr', etc. create dates with year as frequency. Does anybody know what to pass in, or if it is possible at all?