Pandas 存储从数据帧获得的值

Pandas 存储从数据帧获得的值,pandas,Pandas,当前位置['percen\u 52周]=“” 其中当前位置和周高为数据帧 错误: raise ValueError("Incompatible indexer with Series") ValueError: Incompatible indexer with Series 我不知道你用的是哪只熊猫,但也许这就是问题所在 current_loc.loc[[i,'percen_52week']]=percen_52week 我想应该是这样 current_loc.loc

当前位置['percen\u 52周]=“”

其中当前位置和周高为数据帧

错误:

 raise ValueError("Incompatible indexer with Series")
ValueError: Incompatible indexer with Series

我不知道你用的是哪只熊猫,但也许这就是问题所在

current_loc.loc[[i,'percen_52week']]=percen_52week
我想应该是这样

current_loc.loc[i,'percen_52week']=percen_52week

我最终解决了这个问题,这个问题与数据类型有关,percen_52week返回的序列数据类型无法在当前位置分配

当percen_52周转换为浮动时,问题得到解决

current_loc.loc[i,'percen_52week']=percen_52week