With pandas.date_range
one can create time columns for one's dataframe with ease such as
df["Data"] = pd.date_range(start='2020-01-01 00:00', end='2020-01-05 02:00', freq='H')
Which something like this
I wonder if is it possible to use date_range
to create, within the range defined (such as the above), 10 entries for each of the time periods. In other words, 10 cells with 2010-01-01 00:00:00
, 10 cells with 2010-01-01 01:00:00
, and so on.
If not, how should one do that?
Try np.repeat
:
df['Data'] = np.repeat(pd.date_range(start='2020-01-01 00:00',
end='2020-01-05 02:00', freq='H'),
10)