我有一个类似于这样的pandas数据框:
正如您所看到的 - 在日期时间索引中,有某些分钟缺失。例如,在屏幕截图中,第一行和第二行之间缺少了9:16:00 - 9:19:00分钟。我想将数据从上一分钟向所有缺失的分钟填充。现在,我们到达了复杂的部分 - 我需要帮助的部分。我只需要在每个日期的09:15:00和15:30:00之间填充分钟。对于任何被填充的行,列“Volume”应该有一个值“0”。
为了帮助您探索数据,我已经将前几行导出到了一个json对象中(我认为日期时间索引已转换为毫秒)。
{
"1580464080000": {
"expiry": "4/30/2020",
"close": 12157.3,
"high": 12157.3,
"volume": 0,
"open": 12157.3,
"low": 12157.3,
"timezone": "+05:30"
},
"1580463120000": {
"expiry": "4/30/2020",
"close": 12200.3,
"high": 12200.3,
"volume": 0,
"open": 12200.3,
"low": 12200.3,
"timezone": "+05:30"
},
"1580464260000": {
"expiry": "4/30/2020",
"close": 12150.0,
"high": 12150.0,
"volume": 0,
"open": 12150.0,
"low": 12150.0,
"timezone": "+05:30"
},
"1580462400000": {
"expiry": "4/30/2020",
"close": 12174.0,
"high": 12174.0,
"volume": 0,
"open": 12174.0,
"low": 12174.0,
"timezone": "+05:30"
},
"1580462820000": {
"expiry": "4/30/2020",
"close": 12193.7,
"high": 12193.7,
"volume": 0,
"open": 12193.7,
"low": 12193.7,
"timezone": "+05:30"
},
"1580462100000": {
"expiry": "4/30/2020",
"close": 12180.0,
"high": 12180.0,
"volume": 0,
"open": 12180.0,
"low": 12180.0,
"timezone": "+05:30"
},
"1580464440000": {
"expiry": "4/30/2020",
"close": 12160.45,
"high": 12160.45,
"volume": 0,
"open": 12160.45,
"low": 12160.45,
"timezone": "+05:30"
}
}