Python Pandas phone numbers cleaning by eliminating consecutive repeated characters
You should use regex to find such patters.
For example:
(\d)\1{4,}
This will match a digit and check if it repeats itself 4 more times. This is the case in examples 1, 2, 4 & 5
Another example is: (\d\d)\1{2,}
This will match 2 digits and checks if it repeats itself 2 more times. This is the case in examples 1, 3, 4, 5 & 6
I have a retail dataset that consists of uncleaned mobile phone numbers. I have data like this




Phone Number




03451000000


03451000001


03451010101


03451111111


03459999999


03459090909




Now there is a very high probability that the above phone numbers are fakely entered by cashier. The genuine number looks like this for example 03453485413.
There are two important things:

The length of the string is always fixed 11 characters
The phone number always starts with 03*********

Now how do I eliminate phone numbers based on the rule that, for example, character repetition of more than 5 times eliminated?