且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python - 用星号替换列中的前五个字符

更新时间:2023-02-12 19:24:08

与 Mr. Me 类似,这将删除前 6 个字符之前的所有内容,并将它们替换为您的新格式.

Similar to Mr. Me, this will instead remove everything before the first 6 characters and replace them with your new format.

emp_pd["SSN"] = emp_pd["SSN"].apply(lambda x: "***-**" + x[6:])