I'm trying to read in a csv file through Pandas.
pd.read_csv('zip_mapping.gz',compression='gzip' ,header=None, sep=',')
But somehow I read in zip as float, like
0 501.0
1 1220.0
2 1509.0
3 1807.0
4 2047.0
as I don't know zip is in which column before I read in the data, so I could not set dtype in pd.read_csv.
I want to change zip into int, but due to missing values I got " could not convert NA to int "error.
Tried
str(zip).rstrip('0').rstrip('.')
But got this
'0 501.0\n1 1220.0\n2 1509.0\n3 1807.0\n4 2047.0\nName: zip, dtype: float64'
Actually I want convert zip in float into str like 501, 1220, 1509, 1807, 2047 then I could further padding leading zeros.
Any suggestion? Thank you.