zoukankan      html  css  js  c++  java
  • Pandas---7.字符串操作

    1.Series.map

    通过Series.map()方法,所有字符串和正则表达式方法都能应用于各个值。但是如果存在NaN就会报错。为了解决这个问题,pandas提供了一些能够跳过NaN值的字符串操作方法。

    2.Series.str.ufunc

    Series.str能够将Series的值当作字符串处理,并且你可以通过Series.str.func来应用某些函数。其中func可以为:

    Series.str.capitalize()
    Series.str.cat([others, sep, na_rep])
    Series.str.center(width[, fillchar])
    Series.str.contains(pat[, case=True, flags=0, na=nan, regex=True])
    Series.str.count(pat[, flags])
    Series.str.decode(encoding[, errors])
    Series.str.encode(encoding[, errors])
    Series.str.endswith(pat[, na])
    Series.str.extract(pat[, flags, expand])
    Series.str.extractall(pat[, flags])
    Series.str.find(sub[, start, end])
    Series.str.findall(pat[, flags])
    Series.str.get(i)
    Series.str.index(sub[, start, end])
    Series.str.join(sep)
    Series.str.len()
    Series.str.ljust(width[, fillchar])
    Series.str.lower()
    Series.str.lstrip([to_strip])
    Series.str.match(pat[, case=True, flags=0, na=nan, as_indexer=False])
    Series.str.normalize(form)
    Series.str.pad(width[, side, fillchar])
    Series.str.partition([pat, expand])
    Series.str.repeat(repeats)
    Series.str.replace(pat, repl[, n, case, flags])
    Series.str.rfind(sub[, start, end])
    Series.str.rindex(sub[, start, end])
    Series.str.rjust(width[, fillchar])
    Series.str.rpartition([pat, expand])
    Series.str.rstrip([to_strip])
    Series.str.slice([start, stop, step])
    Series.str.slice_replace([start, stop, repl])
    Series.str.split([pat, n, expand])
    Series.str.rsplit([pat, n, expand])
    Series.str.startswith(pat[, na])
    Series.str.strip([to_strip])
    Series.str.swapcase()
    Series.str.title()
    Series.str.translate(table[, deletechars])
    Series.str.upper()
    Series.str.wrap(width, **kwargs)
    Series.str.zfill(width)
    Series.str.isalnum()
    Series.str.isalpha()
    Series.str.isdigit()
    Series.str.isspace()
    Series.str.islower()
    Series.str.isupper()
    Series.str.istitle()
    Series.str.isnumeric()
    Series.str.isdecimal()
    Series.str.get_dummies([sep])
    

      

  • 相关阅读:
    Java中Volatile关键字详解
    java hashmap&concurrentHashmap源理
    java CAS和AQS
    jvm内存模型
    springAop源码分析
    一个项目设置两个git地址,并最终实现一次性同时推送到到两个git地址上的方法总结
    H5实现横向滚动的方法总结
    tab吸顶的神奇-- css粘性属性
    H5制作显示轮播图的方法Swiper
    微信H5中禁止分享好友及分享到朋友圈的方法
  • 原文地址:https://www.cnblogs.com/nxf-rabbit75/p/12108466.html
Copyright © 2011-2022 走看看