2021-11-30

How to convert float to int and concatenate with a string?

I have an array of years ,por. The years are currently floats and include a decimal like 1942.0. I want to remove the decimal place and add "-12-31" so that I have an array with entries that look like "1942-12-31". I wrote the loop below but when I run it, the decimal remains and the first few instances of the array remain unchanged. Where am I going wrong?

por=CMStations.por
for i in por:
    int(i)
    por.loc[i]=str(i)+"-12-31"


from Recent Questions - Stack Overflow https://ift.tt/2ZyDTJM
https://ift.tt/eA8V8J

No comments:

Post a Comment