【问题标题】:Cutting a string after the last occurrence of certain sign在某个符号最后一次出现后切断字符串
【发布时间】:2022-06-18 01:50:55
【问题描述】:

您能帮我解决以下问题吗?我在 pandas df 中有一个名为“名称”的列,其中包含指向网页的链接。我需要创建一个名为“total categories”的变量,该变量将包含最后出现“/”符号之后出现的链接部分。示例:

names
https://www1.abc.com/aaa/72566-finance
https://www1.abc.com/aaa1/725-z2
https://www1.abc.com/aaa2/75-z3

total categories
72566-finance
725-z2
75-z3

【问题讨论】:

  • 好的,那么到目前为止您尝试过什么? split("/")[-1] 不适合你吗?

标签: python pandas string


猜你喜欢
  • 2014-01-21
  • 2020-09-17
  • 2015-05-11
  • 2012-06-05
  • 2015-06-13
  • 2012-05-31
  • 2023-02-04
  • 2021-08-22
  • 1970-01-01
相关资源
最近更新 更多