python 交易日期月末

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 交易日期月末相关的知识,希望对你有一定的参考价值。

    @staticmethod
    def convert_monthly(df,date_field,endswith='trade_dt'):
        ds = df[date_field].unique()
        if endswith=='trade_dt':
            tds = pd.Series(ds, ds).resample('M').last().values
        else:
            tds=pd.Series(ds,ds).resample('M').last().index.tolist()
        df = df[df['con_date'].isin(tds)]
        return df

以上是关于python 交易日期月末的主要内容,如果未能解决你的问题,请参考以下文章