我尝试使用数据帧的df.groupby('type')['value'].apply(lambda x: x.pct_change())来计算groupby pct_change。但是它会产生ValueError: cannot reindex from a duplicate axis,你有什么想法来处理这个问题吗?谢谢。
我已经在其他一些代码中使用了.loc,它工作得很好,但我已经在这个代码上使用了几个小时,到目前为止还没有运气。我的目标是在满足条件的任何地方使用另外两个数据帧在数据帧中创建并填充一列。What does ValueError: cannot reindex from a duplicate axis mean?import pandas as pdcondition = df2['Period'] ==