So I am working with tick data and I am attempting to resample the dataframe to minute bars, but when resample is called the time series begins and ends the first instance that a tick exists. How would I resample this data such that the first and last times can be specified to a certain start and end time?
Edit here is some sample data.
df = pd.DataFrame(data={'Code': pd.Series(['A', 'A', 'B', 'B'], dtype='str'), 'Timestamp': pd.Series([1608627600073933, 1698929600124359, 1608627600073933, 1608929600124359], dtype='datetime64[ns]'),
'Val':[5, 6, 5, 6]})
df.set_index(['Timestamp'], inplace=True)
df.groupby('Code').resample('1T').agg('sum')
Which outputs
Val
Timestamp
1970-01-19 14:50:00 5
1970-01-19 14:51:00 0
1970-01-19 14:52:00 0
1970-01-19 14:53:00 0
1970-01-19 14:54:00 0
1970-01-19 14:55:00 6
But I would like an output dataframe that includes a timestamp for every minute of a specific hour for example.