0
import pandas as pd
df=pd.read_excel('test.xlsx')
ab= df.MobileNum.str.replace(' ','')
print ab

As in the screenshot you can see first four row shows nan which is my 10 digit original number without space and other has spaces . so i want to show first four row data with this result.

1 Answers1

0

You can always do this:

new = df.MobileNum.str.replace(r"\s+", "")
print(new)