Blocking Seven Digit Numbers In String Pandas April 21, 2024 Post a Comment Background I have the following sample df import pandas as pd df = pd.DataFrame({'Text':['This person num is 111-888-8888 and other', 'dont block 23 here'Solution 1: You can try this regex expression. ((?:[\d]-?){7,})Regex DemoFinal block of code is thisdf['New_Text'] = df['Text'].str.replace(r'((?:[\d]-?){7,})','**Block**') Copy Share Post a Comment for "Blocking Seven Digit Numbers In String Pandas"
Post a Comment for "Blocking Seven Digit Numbers In String Pandas"