本文整理汇总了Python中pandas.TimeSeries.reindex方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.reindex方法的具体用法?Python TimeSeries.reindex怎么用?Python TimeSeries.reindex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.reindex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _divide
# 需要导入模块: from pandas import TimeSeries [as 别名]
# 或者: from pandas.TimeSeries import reindex [as 别名]
def _divide(self, frame):
if self.cash_afterward == 0:
return
cashes = [self.cash_afterward, 0.0]
adj_day = self.ex_date - datetime.timedelta(days=1)
indexes = []
indexes.append(adj_day)
indexes.append(datetime.date.today())
cashes = TimeSeries(cashes, index=indexes)
ri_cashes = cashes.reindex(frame.index, method='backfill')
frame['adjclose'] = frame['adjclose'] - ri_cashes
示例2: _split
# 需要导入模块: from pandas import TimeSeries [as 别名]
# 或者: from pandas.TimeSeries import reindex [as 别名]
def _split(self, frame):
if self.share_afterward == 1:
return
splits = [self.share_afterward, 1.0]
adj_day = self.ex_date - datetime.timedelta(days=1)
indexes = []
indexes.append(adj_day)
indexes.append(datetime.date.today())
splits = TimeSeries(splits, index=indexes)
ri_splits = splits.reindex(frame.index, method='backfill')
frame['adjclose'] = frame['adjclose'] / ri_splits
示例3: _divide
# 需要导入模块: from pandas import TimeSeries [as 别名]
# 或者: from pandas.TimeSeries import reindex [as 别名]
def _divide(self, frame):
"""divided close price to adjclose column
WARNING
=======
frame should be chronological ordered otherwise wrong backfill.
"""
if self.cash_afterward == 0:
return
cashes = [self.cash_afterward, 0.0]
adj_day = self.ex_date - datetime.timedelta(days=1)
indexes = []
indexes.append(self.d2t(adj_day))
indexes.append(self.d2t(datetime.date.today()))
cashes = TimeSeries(cashes, index=indexes)
ri_cashes = cashes.reindex(frame.index, method='backfill')
frame['adjclose'] = frame['adjclose'] - ri_cashes