Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Validation of Phone Numbers in a String using REGEX #29

Open
RohitDhankar opened this issue Apr 29, 2020 · 2 comments
Open

Validation of Phone Numbers in a String using REGEX #29

RohitDhankar opened this issue Apr 29, 2020 · 2 comments
Assignees

Comments

@RohitDhankar
Copy link
Member

RohitDhankar commented Apr 29, 2020

1/ In a pandas DF - Check for phone numbers in a String
2/ If a valid Number extract the number and populate in a New Column of DF
3/ If no valid Number - then write "No_Valid_Tele" to the New Column
4/ Phone Numbers can be International Phone Numbers as an example an Austrian Number will start with Country Code = Austria (AT) countryCode=43 , while an Indian one with countryCode= 91.
5/ We need to extract Country code and then in a New Column of DF , provide the Country Code and Country Name

Phones Validation - re.compile("(0/91)?[7-9][0-9]{9}")
https://pypi.org/project/phonenumbers/
https://stackoverflow.com/questions/15258708/python-trying-to-check-for-a-valid-phone-number
https://stackoverflow.com/questions/16135069/python-validation-mobile-number

Don think there is a public dataset of phone numbers to test , for international numbers
We can try this XML file and convert from XML to CSV file to create our own test data sets ... need to pick this from XML file == Austria (AT) countryCode=43 , and the Mobile numbers etc ... also given Regex Patterns in this XML file can be used .

https://github.com/daviddrysdale/python-phonenumbers/blob/dev/resources/PhoneNumberAlternateFormats.xml
https://pypi.org/project/xmlutils/1.1/
http://blog.appliedinformaticsinc.com/how-to-parse-and-convert-xml-to-csv-using-python/

@abhijeetmote
Copy link
Collaborator

Hi Rohit,
Following is the code, today I will update the final code. I was busy with office stuff, so couldn't make it.
xml_parser.txt

@abhijeetmote
Copy link
Collaborator

Hi Rohit,
Following is the updated version of the code. Kindly suggest if any code changes needed.

xmlparsing.txt

Thanks & Regards,
Abhijeet

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants