【发布时间】:2020-01-27 14:53:51
【问题描述】:
我正在尝试使用 for 循环遍历 DataFrame,但出现此错误:
"ValueError: Series 的真值不明确。"
我想遍历“Plataforma”和“Soporte”来替换“Soporte”值。 我正在使用这个:
for index, row in informe.iterrows():
if informe.loc[index, 'Plataforma'] == 'Taboola':
informe['Soporte'].str.replace('performance-prospecting_tconvergentes', 'Prospecting_Taboola_tconvergentes')
informe['Soporte'].str.replace('performance-prospecting_tmoviles', 'Prospecting_Taboola_tmoviles')
informe['Soporte'].str.replace('performance-prospecting', 'Prospecting_Taboola')
elif informe.loc[index, 'Plataforma'] == 'Yahoo':
informe['Soporte'].str.replace('performance-prospecting_tconvergentes', 'Prospecting_Yahoo_tconvergentes')
informe['Soporte'].str.replace('performance-prospecting_tmoviles', 'Prospecting_Yahoo_tmoviles')
informe['Soporte'].str.replace('performance-prospecting', 'Prospecting_Yahoo')
提前致谢。
【问题讨论】: