I\'m trying to see if I can remove the trailing zeros from this phone number column.
Example:
0 1 8.00735e+09 2 4.35789e+09 3 6.10644e
Try str.isnumeric with astype and loc:
str.isnumeric
astype
loc
s = pd.Series(['', 8.00735e+09, 4.35789e+09, 6.10644e+09]) c = s.str.isnumeric().astype(bool) s.loc[c] = s.loc[c].astype(np.int64) print(s)
And now:
print(s)
Outputs:
0 1 8007350000 2 4357890000 3 6106440000 dtype: object