0

I am trying to re-sample the 15min data to 75 min data starting of each day to be 09:15:00. I tried below method.

Input data Inputdata

resampling_dict = {"open": "first","high": "max","low": "min","close": "last", "volume": "sum"}
df=df.resample('75min',offset="15min").apply(resampling_dict).dropna()

But not getting the output in desired format. Some of the days starting with the time 08:45:00. some time 09:00:00 some time 09:15:00. I need all days to start with 09:15:00 and end of the day time 14:15:00. Please help to modify the re-sampling

OutPut got:- OutPut got

Input data

 |datetime       |open  |high   |low  |close|volume|
|----------------|------|------|------|-----|------|
|12-08-2022 09:15|542.45|544.45|540.55|542.5|301938|
|12-08-2022 09:30|542.6|542.6|540.15|540.8|134226|
|12-08-2022 09:45|540.95|544.85|540.95|544.1|162522|
|12-08-2022 10:00|544.15|545.45|543.65|545.35|110748|
|12-08-2022 10:15|545.45|547.3|544.95|547.05|234712|
|12-08-2022 10:30|547.1|547.55|546.25|546.7|135769|
|12-08-2022 10:45|546.6|548.35|546.45|547.5|134623|
|12-08-2022 11:00|547.45|547.5|546.05|546.2|116934|
|12-08-2022 11:15|546.2|547|546.05|546.55|54838|
|12-08-2022 11:30|546.65|547|546.3|547|65242|
|12-08-2022 11:45|547|547|546.05|546.45|65275|
|12-08-2022 12:00|546.45|547|546.3|546.6|46999|
|12-08-2022 12:15|546.6|546.7|545.55|545.8|68163|
|12-08-2022 12:30|545.9|547.8|545.6|547.8|70189|
|12-08-2022 12:45|547.65|547.95|547.25|547.35|69162|
|12-08-2022 13:00|547.3|547.4|546.2|546.55|61983|
|12-08-2022 13:15|546.75|547|546.05|546.7|59600|
|12-08-2022 13:30|546.7|546.8|546.25|546.7|44131|
|12-08-2022 13:45|546.7|547|546.1|546.75|40607|
|12-08-2022 14:00|546.9|547.6|546.75|547.5|55227|
|12-08-2022 14:15|547.5|547.65|545.5|546|145479|
|12-08-2022 14:30|546|546|545.25|545.25|83029|
|12-08-2022 14:45|545.65|545.7|544.25|545|149544|
|12-08-2022 15:00|545.15|546|544.7|545|219297|
|12-08-2022 15:15|545|545.5|543.75|544|268741|
|16-08-2022 09:15|547.7|550.55|546|549.05|241392|
|16-08-2022 09:30|549|549.5|547.5|549.4|94964|
|16-08-2022 09:45|549.4|551|548.55|550.55|143362|
|16-08-2022 10:00|551|554|550.6|552.5|310110|
|16-08-2022 10:15|552.5|558.45|552.45|557.55|610681|
|16-08-2022 10:30|557.8|560.75|556.65|560|598953|
|16-08-2022 10:45|560.05|570.7|559.15|570.15|1340238|
|16-08-2022 11:00|570.5|572.9|567.75|568.05|917564|
|16-08-2022 11:15|568.05|568.4|562.65|565.4|546206|
|16-08-2022 11:30|565.3|566.45|564.2|564.4|719396|
|16-08-2022 11:45|564.5|566.8|563.5|566.2|203977|
|16-08-2022 12:00|566.2|569|565.65|568.4|364797|
|16-08-2022 12:15|568.4|568.55|566.65|567.1|111232|
|16-08-2022 12:30|567.05|567.1|565.8|566.45|137490|
|16-08-2022 12:45|566.45|568|566.35|566.95|125581|
|16-08-2022 13:00|566.75|570.35|566.65|567.5|336535|
|16-08-2022 13:15|567.8|569.95|567.5|569|232338|
|16-08-2022 13:30|569|569|566.75|567.3|190327|
|16-08-2022 13:45|567.3|567.55|566.15|566.6|88751|
|16-08-2022 14:00|566.6|568|566.6|567.8|101257|
|16-08-2022 14:15|567.8|567.8|566.25|566.65|145082|
|16-08-2022 14:30|566.65|568.05|566|566.9|413550|
|16-08-2022 14:45|566.9|569.35|566.9|569.25|258037|
|16-08-2022 15:00|569.1|570.55|568.45|570.05|510229|
|16-08-2022 15:15|570.25|572|570.05|571|1032609|
|17-08-2022 09:15|571.6|576.7|570|576.3|492507|
|17-08-2022 09:30|576.75|585.9|576.4|585.4|1776400|
|17-08-2022 09:45|585|588.8|585|586.1|592435|
|17-08-2022 10:00|586.4|586.5|583.1|584|286601|
|17-08-2022 10:15|584|585.75|583.8|584.35|191530|
|17-08-2022 10:30|584.15|585.65|583.55|585.1|419714|
|17-08-2022 10:45|585|585.45|584.5|584.9|484377|
|17-08-2022 11:00|585|586.8|584.65|584.9|186542|
|17-08-2022 11:15|584.9|585.5|584.75|585|100714|
|17-08-2022 11:30|585.15|585.2|584.5|585.15|158355|
|17-08-2022 11:45|585.15|585.5|584.9|585.1|208906|
|17-08-2022 12:00|585.1|585.9|585|585.35|90882|
|17-08-2022 12:15|585.35|586.75|585|586.6|293181|
|17-08-2022 12:30|586.5|587.6|585.9|587.45|184111|
|17-08-2022 12:45|587.45|589|587|588.1|351311|
|17-08-2022 13:00|588.35|588.5|587.15|588.1|216597|
|17-08-2022 13:15|588.1|588.35|587.2|588.1|186334|
|17-08-2022 13:30|588.15|588.7|588|588.45|211340|
|17-08-2022 13:45|588.45|591.7|588|590.7|456780|
|17-08-2022 14:00|590.65|590.75|588|588.15|194323|
|17-08-2022 14:15|588.4|590|588|588.75|179382|
|17-08-2022 14:30|588.8|589.25|588.2|588.7|95972|
|17-08-2022 14:45|588.45|589.4|588.35|588.8|111741|
|17-08-2022 15:00|588.85|590.5|588.3|589.6|820255|
|17-08-2022 15:15|589.65|591.45|589.4|590.2|473569|
|18-08-2022 09:15|590.2|598.95|588.35|596.7|1358826|
|18-08-2022 09:30|597|597.7|593.1|593.45|690315|
|18-08-2022 09:45|593.35|596.3|592.6|594.9|416585|
|18-08-2022 10:00|594.95|596.8|593.5|594.85|211125|
|18-08-2022 10:15|594.85|595.5|593.05|593.5|160690|
|18-08-2022 10:30|593.45|594.5|592|593.9|212554|
|18-08-2022 10:45|594.05|596|594|596|152592|
|18-08-2022 11:00|596|596|594.15|594.15|63155|
|18-08-2022 11:15|594.05|594.65|592.45|592.75|477373|
|18-08-2022 11:30|592.5|593.1|591.25|592.05|117190|
|18-08-2022 11:45|592.05|592.55|590.2|591.45|237488|
|18-08-2022 12:00|591.45|591.5|590.1|590.9|97494|
|18-08-2022 12:15|590.85|591.3|590.2|590.2|71620|
|18-08-2022 12:30|590.15|592.15|590.1|591.75|96078|
|18-08-2022 12:45|591.75|592|590.5|591.45|120217|
|18-08-2022 13:00|591.45|592.05|591.2|591.35|52450|
|18-08-2022 13:15|591.4|592|590.9|591.75|65545|
|18-08-2022 13:30|591.75|592|585.7|586.9|442681|
|18-08-2022 13:45|586.9|588.3|585.3|585.5|276393|
|18-08-2022 14:00|585.75|585.75|583|584.95|433857|
|18-08-2022 14:15|584.9|586.75|584.15|584.95|196147|
|18-08-2022 14:30|584.95|586.1|584.65|585.9|63181|
|18-08-2022 14:45|585.9|587.85|585.6|587|126713|
|18-08-2022 15:00|586.95|588|585.85|587.6|474059|
|18-08-2022 15:15|587.35|588.45|585|586.8|491988|
|19-08-2022 09:15|586.6|594.4|586.4|588.4|1050739|
|19-08-2022 09:30|588.15|590.05|581.55|582.6|340291|
|19-08-2022 09:45|582.6|583.6|580.25|581|304076|
|19-08-2022 10:00|581|582|579|580.55|138315|
|19-08-2022 10:15|580.35|580.9|579|580|153574|
|19-08-2022 10:30|580|580.7|579.7|580.15|55903|
|19-08-2022 10:45|580.15|580.3|579.3|579.95|94308|
|19-08-2022 11:00|579.8|580|577.55|579.35|133019|
|19-08-2022 11:15|579.4|580.25|578|578.9|127876|
|19-08-2022 11:30|578.75|579.25|576.5|577.35|97379|
|19-08-2022 11:45|577.3|577.95|576.75|577|59032|
|19-08-2022 12:00|577|577.55|576.05|577.1|57742|
|19-08-2022 12:15|577.4|577.4|575.3|575.8|117269|
|19-08-2022 12:30|575.9|579.2|575.05|578.3|99968|
|19-08-2022 12:45|578.25|580.25|578.15|578.8|116817|
|19-08-2022 13:00|578.85|580.5|578.8|579.95|52464|
|19-08-2022 13:15|580|580|578.8|579.6|72900|
|19-08-2022 13:30|579.55|579.9|578|578.9|38972|
|19-08-2022 13:45|578.75|578.95|576.2|576.95|68117|
|19-08-2022 14:00|577|577|575.25|576.8|67857|
|19-08-2022 14:15|576.8|577|576.35|577|64872|
|19-08-2022 14:30|577|579|576.6|578.6|109654|
|19-08-2022 14:45|578.8|579.3|576.85|578.4|85241|
|19-08-2022 15:00|578.2|578.6|576.3|577.2|179186|
|19-08-2022 15:15|577.35|577.35|573.8|575.7|296822|
|22-08-2022 09:15|576|576|570|570.35|280578|
|22-08-2022 09:30|570.15|572.75|570.15|572.4|91795|
|22-08-2022 09:45|572.8|574.5|571.5|573.1|79606|
|22-08-2022 10:00|573.2|573.8|571.3|573.8|91376|
|22-08-2022 10:15|573.7|574.65|573.5|573.8|56634|
|22-08-2022 10:30|573.8|574.25|573.15|574|49018|
|22-08-2022 10:45|574.15|575.3|574|574.4|81820|
|22-08-2022 11:00|574.4|576.65|573.35|573.85|218338|
|22-08-2022 11:15|574|574.3|573.7|574.1|27400|
|22-08-2022 11:30|574.1|574.65|573.8|574.2|17484|
|22-08-2022 11:45|574.25|574.95|573.65|574|172283|
|22-08-2022 12:00|574|574.25|572.65|573.1|108385|
|22-08-2022 12:15|573.2|574.95|573|574.4|52170|
|22-08-2022 12:30|574.4|575.65|574.1|574.3|77061|
|22-08-2022 12:45|574.25|574.95|573.2|573.7|25312|
|22-08-2022 13:00|573.7|574|571.95|571.95|57726|
|22-08-2022 13:15|572.2|572.35|570.45|571.05|71791|
|22-08-2022 13:30|571|571.7|570.7|571.25|40266|
|22-08-2022 13:45|571.25|572.1|570.8|571.35|43446|
|22-08-2022 14:00|571.4|572|571.1|571.5|54109|
|22-08-2022 14:15|571.5|571.85|570.7|571|68598|
|22-08-2022 14:30|571|571|568.8|569.25|88656|
|22-08-2022 14:45|569.25|570|566.75|566.9|114359|
|22-08-2022 15:00|567.05|567.15|565.6|566.85|290549|
|22-08-2022 15:15|566.8|567.2|566.2|567|309955|
|23-08-2022 09:15|563|568.45|562.2|567.35|169110|
|23-08-2022 09:30|567.3|569.5|567.1|568|81229|
|23-08-2022 09:45|568|570.9|567.4|570.75|193647|
|23-08-2022 10:00|570.9|571.3|567.35|567.35|71712|
|23-08-2022 10:15|567.1|568.9|566.15|568.05|77748|
|23-08-2022 10:30|568.15|568.35|564.65|566.55|92462|
|23-08-2022 10:45|566.7|566.7|564.45|565.25|47776|
|23-08-2022 11:00|565.25|565.3|562.65|563.95|84046|
|23-08-2022 11:15|564|565.25|563.65|564.25|51161|
|23-08-2022 11:30|564.25|568|563.85|566.7|147470|
|23-08-2022 11:45|566.75|567|563.75|564|172195|
|23-08-2022 12:00|564|564.75|562.75|563.25|315289|
|23-08-2022 12:15|563.25|564|563.1|564|19954|
|23-08-2022 12:30|564|565|563.8|564.4|101774|
|23-08-2022 12:45|564.25|564.9|563.15|564|126023|
|23-08-2022 13:00|564|564.35|562.65|563.7|32862|
|23-08-2022 13:15|563.75|564.45|563.1|564|45055|
|23-08-2022 13:30|564|565|563.85|564.3|89136|
|23-08-2022 13:45|564.2|564.5|563.75|564.5|74155|
|23-08-2022 14:00|564.55|567.5|564.5|565.8|170597|
|23-08-2022 14:15|565.8|567.45|565.4|565.6|59888|
|23-08-2022 14:30|565.9|567.3|565.1|567|44008|
|23-08-2022 14:45|566.9|567|565.5|566.35|70119|
|23-08-2022 15:00|566.3|566.35|564.2|565.95|182035|
|23-08-2022 15:15|565.95|567.6|565.65|567.5|195208|
|24-08-2022 09:15|567.85|567.85|564|566.35|149919|
|24-08-2022 09:30|566.3|566.3|563.15|564.9|122335|
|24-08-2022 09:45|564.9|567.5|564.9|567.5|78667|
|24-08-2022 10:00|567.5|571.5|567.35|570.65|193594|
|24-08-2022 10:15|570.75|571|568.7|570.6|125405|
|24-08-2022 10:30|570.7|574.25|570.6|574|306455|
|24-08-2022 10:45|574.1|574.25|571|571.3|350471|
|24-08-2022 11:00|571|571.45|570|571|68960

output data

  |datetime|open|high|low|close|volume|
  |--------|--------|--------|--------|
  |12-08-2022 09:15|542.45|547.3|540.15|547.05|944146|
  |12-08-2022 10:30|547.1|548.35|546.05|547|507406|
  |12-08-2022 11:45|547|547.95|545.55|547.35|319788|
  |12-08-2022 13:00|547.3|547.6|546.05|547.5|261548|
  |12-08-2022 14:15|547.5|547.65|543.75|544|866090|
  |16-08-2022 09:15|547.7|558.45|546|557.55|1400509|
  |16-08-2022 10:30|557.8|572.9|556.65|564.4|4122357|
  |16-08-2022 11:45|564.5|569|563.5|566.95|943077|
  |16-08-2022 13:00|566.75|570.35|566.15|567.8|949208|
  |16-08-2022 14:15|567.8|572|566|571|2359507|
  |17-08-2022 09:15|571.6|588.8|570|584.35|3339473|
  |17-08-2022 10:30|584.15|586.8|583.55|585.15|1349702|
  |17-08-2022 11:45|585.15|589|584.9|588.1|1128391|
  |17-08-2022 13:00|588.35|591.7|587.15|588.15|1265374|
  |17-08-2022 14:15|588.4|591.45|588|590.2|1680919|
  |18-08-2022 09:15|590.2|598.95|588.35|593.5|2837541|
  |18-08-2022 10:30|593.45|596|591.25|592.05|1022864|
  |18-08-2022 11:45|592.05|592.55|590.1|591.45|622897|
  |18-08-2022 13:00|591.45|592.05|583|584.95|1270926|
  |18-08-2022 14:15|584.9|588.45|584.15|586.8|1352088|
  |19-08-2022 09:15|586.6|594.4|579|580|1986995|
  |19-08-2022 10:30|580|580.7|576.5|577.35|508485|
  |19-08-2022 11:45|577.3|580.25|575.05|578.8|450828|
  |19-08-2022 13:00|578.85|580.5|575.25|576.8|300310|
  |19-08-2022 14:15|576.8|579.3|573.8|575.7|735775|
  |22-08-2022 09:15|576|576|570|573.8|599989|
  |22-08-2022 10:30|573.8|576.65|573.15|574.2|394060|
  |22-08-2022 11:45|574.25|575.65|572.65|573.7|435211|
  |22-08-2022 13:00|573.7|574|570.45|571.5|267338|
  |22-08-2022 14:15|571.5|571.85|565.6|567|872117|
  |23-08-2022 09:15|563|571.3|562.2|568.05|593446|
  |23-08-2022 10:30|568.15|568.35|562.65|566.7|422915|
  |23-08-2022 11:45|566.75|567|562.75|564|735235|
  |23-08-2022 13:00|564|567.5|562.65|565.8|411805|
  |23-08-2022 14:15|565.8|567.6|564.2|567.5|551258|
  |24-08-2022 09:15|567.85|571.5|563.15|570.6|669920|
  |24-08-2022 10:30|570.7|574.25|570|572.05|855168|
  |24-08-2022 11:45|572.05|572.15|571.5|571.7|1462

0 Answers0