Skip to content

pd.DataFrame.replace

pandas.DataFrame.replace(to_replace=None, value=None, inplace=False, limit=None, regex=False, method='pad')

支持的参数

  • to_replace: 各种标量
    • 必需参数
  • value: 各种标量
    • 必须与 to_replace 的类型相同

示例用法

>>> @bodo.jit
... def f():
...   df = pd.DataFrame({"A": [1,2,3], "B": [4,5,6], "C": [7,8,9]})
...   return df.replace(1, -1)
>>> f()
   A  B  C
0 -1  4  7
1  2  5  8
2  3  6  9