Pandas - remove numbers from start of string in series

后端 未结 2 1941
花落未央
花落未央 2021-01-16 12:47

I\'ve got a series of addresses and would like a series with just the street name. The only catch is some of the addresses don\'t have a house number, and some do.

2条回答
  •  野的像风
    2021-01-16 13:24

    You can use str.replace with regex ^\d+\s+ to remove leading digits:

    s.str.replace('^\d+\s+', '')
    
    Out[491]:
    0         SOUTH PARK
    1        BRAKER LANE
    2             3RD ST
    3    BIRMINGHAM PARK
    4             E 12TH
    Name: Idx, dtype: object
    

提交回复
热议问题