0

I have a list of phone numbers in an excel sheet, along with other information related to the phone numbers. The phone numbers can be from different countries, so they start with a + sign, followed by a country code (for example +1055592947). The string is stored in excel as '+1055592947 to make it appear as a string.

However, when I read the excel file, the plus sign is lost. How can I prevent this from happening?

df = pd.read_excel(data_file_location, index_col=0)
Simen Russnes
  • 2,002
  • 2
  • 26
  • 56

2 Answers2

1

You can define that it is a string when reading the file as follows:

pd.read_excel('Book.xlsx',dtype = {'colname': str})

enter image description here

Billy Bonaros
  • 1,671
  • 11
  • 18
1

Refer documentation to handle the datatypes here enter image description here