How to remove numbers from string terms in a pandas dataframe

前端 未结 4 1067
离开以前
离开以前 2020-12-04 15:42

I have a data frame similar to the one below:

Name    Volume  Value
May21   23      21321
James   12      12311
Adi22   11      4435
Hello   34      32454
Gi         


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 16:05

    You can do it like so:

    df.Name = df.Name.str.replace('\d+', '')
    

    To play and explore, check the online Regular expression demo here: https://regex101.com/r/Y6gJny/2

    Whatever is matched by the pattern \d+ i.e 1 or more digits, will be replaced by empty string.

提交回复
热议问题