I need to convert the first column of the Excel sheet into an integer value. Need to remove the string (say LP001005
, remove LP
and get the rest of the number).
I am able to achieve this on a single variable. But, I need to achieve this on the Excel sheet. I mean to convert the entire Excel into the dataframe in pandas and to extract the Loan_ID
and do conversions (remove LP
from LP001005
) and then use the data frame.
>>> import re
>>> test_str = "Geeks4321"
>>> print("The original string is : " + str(test_str))
The original string is : Geeks4321
>>> res = [re.findall(r'(\d+)', test_str)[0] ]
>>> print("The tuple after the split of string and number : " + str(res))
The tuple after the split of string and number : ['4321']
>>>
The Excel sheet looks like below:
LoanID Name
LP1401 Shubhra
LP1102 Ankit
LP1203 Sowmya