📜  1 分钟蜡烛重采样熊猫 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:25.654000             🧑  作者: Mango

代码示例1
def ohlcVolume(x):
    if len(x):
        ohlc={ "open":x["open"][0],"high":max(x["high"]),"low":min(x["low"]),"close":x["close"][-1],"volume":sum(x["volume"])}
        return pd.Series(ohlc)

daily=df.resample('1D').apply(ohlcVolume)