python - How to use pandas to process minute data into hourly lines?
仅有的幸福
仅有的幸福 2017-05-18 11:00:52
0
1
993
                    code    open    high    low     close

date
2017-04-10 09:01:00 jd1709 3992.0 3992.0 3982.0 3984.0
2017-04-10 09:02:00 jd1709 3985.0 3988.0 3980.0 3986.0
2017- 04-10 09: 03:00 jd1709 3986.0 3986.0 3973.0 3977.0
2017-04-10 09:04:00 jd1709 3977.0 3983.0 3974.0 3981.0

Like the pandas df data above, I want to transform it into an hourly line, but due to irregular grouping, resample('H') cannot be used
For example, from 21:00-22:00, 22:00-23:00, 23:00-9:30, 9:30-10:45 such customized group summary
Please tell me how to implement it, thank you

仅有的幸福
仅有的幸福

reply all(1)
迷茫

Write a class to define the content field of the hour line
Then read the tuple line by line and record the ohlc of the hour line
Generate a new bar if the time meets the conditions

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!