Skip to content

pd.Series.str.encode

链接到Pandas文档

pandas.Series.str.encode(encoding, errors='strict')

参数限制:

  • encoding: 必须是类型 String
  • errors: 必须是类型 String

注意

输入必须是一个 String 数据的系列。

示例用法

>>> @bodo.jit
... def f(S):
...     return S.str.encode("ascii")
>>> S = pd.Series(["A", "ce", "14", " ", "@", "a n", "^ Ef"])
>>> f(S)
0       b'A'
1      b'ce'
2      b'14'
3       b' '
4       b'@'
5     b'a n'
6    b'^ Ef'
dtype: object