1. 程式人生 > >Pandas 文字資料方法 replace( )

Pandas 文字資料方法 replace( )

Series.str.replace(pat, repl, n=-1, case=True, flags=0)替換指定字元
引數:
pat : 字串,要替換的值可以是正則表示式
repl : 字串,替換值
n : 整型, 要替換幾處(預設-1,表示所有都要替換)
case : 布林值, 如果為True則是嚴格替換
flags : 整型, 如果為0則沒有flags
返回值:
序列Series/索引Index