小编gri*_*per的帖子

替换一系列熊猫中的值

为什么当我想替换一个值时,我必须使用这段代码:

data['Organization'].str.replace('Greece','Rome')
Run Code Online (Sandbox Code Playgroud)

为什么我不能使用这个:

data['Organization'].replace('Greece','Rome').
Run Code Online (Sandbox Code Playgroud)

我之前见过其他人使用方法二而没有传递字符串方法。我的问题是我可以使用替换函数传递一个系列方法吗?代码行是什么?

python regex replace series pandas

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

pandas ×1

python ×1

regex ×1

replace ×1

series ×1