Skip to content
Advertisement

How to resample a dataframe an include start and end times?

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.

JavaScript

Which outputs

JavaScript

But I would like an output dataframe that includes a timestamp for every minute of a specific hour for example.

Advertisement

Answer

You can add start and end datetimes manually:

JavaScript

For add values per days:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement