方法总览

Method方法描述Description
cat()拼接字符串Concatenate strings
split()基于分隔符切分字符串Split strings on delimiter
rsplit()基于分隔符,逆向切分字符串Split strings on delimiter working from the end of the string
get()索引每一个元素(返回第i个元素)Index into each element (retrieve i-th element)
join()使用传入的分隔符依次拼接每一个元素Join strings in each element of the Series with passed separator
get_dummies()用分隔符切分字符串,并返回一个含有哑变量的数据表Split strings on the delimiter returning DataFrame of dummy variables
contains()返回一个布尔矩阵表明是每个元素包含字符串或正则表达式Return boolean array if each string contains pattern/regex
replace()将匹配到的子串或正则表达式替换为另外的字符串,或者一个可调用对象的返回值Replace occurrences of pattern/regex/string with some other string or the return value of a callable given the occurrence
repeat()值复制(s.str.repeat(3)等价于x 3)Duplicate values (s.str.repeat(3) equivalent to x 3)
pad()将白空格插入到字符串的左、右或者两端Add whitespace to left, right, or both sides of strings
center()等价于str.centerEquivalent to str.center
ljust()等价于str.ljustEquivalent to str.ljust
rjust()等价于str.rjustEquivalent to str.rjust
zfill()等价于str.zfillEquivalent to str.zfill
wrap()将长字符串转换为Split long strings into lines with length less than a given width
slice()将序列中的每一个字符串切片Slice each string in the Series
slice_replace()用传入的值替换每一个字串中的切片Replace slice in each string with passed value
count()对出现符合的规则进行计数Count occurrences of pattern
startswith()等价于str.startswith(pat)Equivalent to str.startswith(pat) for each element
endswith()等价于 str.endswith(pat)Equivalent to str.endswith(pat) for each element
findall()返回每一个字串中出现的所有满足样式或正则的匹配Compute list of all occurrences of pattern/regex for each string
match()对每一个元素调用 re.match,并以列表形式返回匹配到的组Call re.match on each element, returning matched groups as list
extract()对每一个元素调用 re.search, 并以数据表的形式返回。行对应原有的一个元素,列对应所有捕获的组Call re.search on each element, returning DataFrame with one row for each element and one column for each regex capture group
extractall()对每一个元素调用 re.findall, 并以数据表的形式返回。行对应原有的一个元素,列对应所有捕获的组Call re.findall on each element, returning DataFrame with one row for each match and one column for each regex capture group
len()计算字符串长度Compute string lengths
strip()等价于str.stripEquivalent to str.strip
rstrip()等价于str.rstripEquivalent to str.rstrip
lstrip()等价于str.lstripEquivalent to str.lstrip
partition()等价于 str.partitionEquivalent to str.partition
rpartition()等价于 str.rpartitionEquivalent to str.rpartition
lower()等价于 str.lowerEquivalent to str.lower
upper()等价于 str.upperEquivalent to str.upper
find()等价于 str.findEquivalent to str.find
rfind()等价于 str.rfindEquivalent to str.rfind
index()等价于 str.indexEquivalent to str.index
rindex()等价于 str.rindexEquivalent to str.rindex
capitalize()等价于 str.capitalizeEquivalent to str.capitalize
swapcase()等价于 str.swapcaseEquivalent to str.swapcase
normalize()返回Unicode 标注格式。等价于 unicodedata.normalizeReturn Unicode normal form. Equivalent to unicodedata.normalize
translate()等价于 str.translateEquivalent to str.translate
isalnum()等价于 str.isalnumEquivalent to str.isalnum
isalpha()等价于 str.isalphaEquivalent to str.isalpha
isdigit()等价于 str.isdigitEquivalent to str.isdigit
isspace()等价于 str.isspaceEquivalent to str.isspace
islower()等价于 str.islowerEquivalent to str.islower
isupper()等价于 str.isupperEquivalent to str.isupper
istitle()等价于 str.istitleEquivalent to str.istitle
isnumeric()等价于 str.isnumericEquivalent to str.isnumeric
isdecimal()等价于 str.isdecimalEquivalent to str.isdecimal