修改Series索引时的语法错误

2024-10-03 02:36:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试更改系列的索引。指数为Datescashflow_series就是这个系列,我只是想通过在索引上使用replace(month = cashflow_series.index[k].month + dict_no_months_between_payments[count])来给这个日期添加一定数量的月份,并用它来替换以前的索引日期。但是,我得到了错误SyntaxError: Invalid Syntax

index_here = cashflow_series.index[k]
cashflow_series.index[k] = cashflow_series.index[k].reindex(index=index_here.(replace(month = cashflow_series.index[k].month + dict_no_months_between_payments[count])))

Tags: no数量indexherecountbetween指数dict