我会链接这两个操作
df_Main["Call Length"].str.replace(":", "").str.replace("0", "")
You're missing to assignment of the replacement back to the original column:
df_Main["Call Length"] = df_Main["Call Length"].str.replace(":", "")
df_Main["Call Length"] = df_Main["Call Length"].str.replace("0", "")
df_Main
Though you can carry out this operation with only one application of replace
:
df_Main["Call Length"] = df["Call Length"].str.replace("[:0]+", "", regex=True)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.