Pandas---7.字符串操作
分类:
Pandas
1.Series.map
通过Series.map()
方法,所有字符串和正则表达式方法都能应用于各个值。但是如果存在NaN
就会报错。为了解决这个问题,pandas
提供了一些能够跳过NaN
值的字符串操作方法。
2.Series.str.ufunc
Series.str能够将Series
的值当作字符串处理,并且你可以通过Series.str.func
来应用某些函数。其中func
可以为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 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]) |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
2018-12-27 去掉python的警告