Skip to content
Advertisement

Populating Country column from international phone numbers

I have a dataframe with several data including the column phone. I would like to create a column name country, based on the phone numbers. The phone numbers are in the format +country_code_phonenumber, i.e.,for several countries. Example

JavaScript

What is the best way to do this with the library phonenumbers? Or is there another way to do it that I’m missing?

Thank you in advance!

Advertisement

Answer

Not sure if it is the best way, but I was not able to find the way without looping…

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement