cudf.core.column.string.StringMethods.ip2int#

StringMethods.ip2int() SeriesOrIndex[source]#

这将IP字符串转换为整数

Returns:
Series/Index of str dtype

示例

>>> import cudf
>>> s = cudf.Series(["12.168.1.1", "10.0.0.1"])
>>> s.str.ip2int()
0    212336897
1    167772161
dtype: int64

如果任何字符串不是IP,则返回0。

>>> s = cudf.Series(["12.168.1.1", "10.0.0.1", "abc"])
>>> s.str.ip2int()
0    212336897
1    167772161
2            0
dtype: int64