I am trying to combine the longitude and latitude columns so I can use to plot my points with GeoPandas. I tried concatenating the integers using:
df3['Location'] = df3['latitude'].astype(str) + ' ' + df3['longitude'].astype(str)
But I get the following error:
sequence item 0: expected str instance, float found
I believe this is because the function only takes string.
df3 = pd.DataFrame({'ID':['1','2','3'], 'latitude': [42.14267,42.131203,42.131638], 'longitude':[-76.902040,-76.917860,-76.822420]})
This is my dataFrame now
ID latitude longitude
0 1 42.142677 -76.902040
1 2 42.131203 -76.917860
2 3 42.131638 -76.822420
But, I want my data frame to look like this. Just a new column, with each row showing the longitude and latitude coordinates separated by a comma and wrapped with parentheses. ex. '(42.142677,-76.902040)'
ID latitude longitude location
0 1 42.142677 -76.902040 (42.142677,-76.902040)
1 2 42.131203 -76.917860 (42.131203, -76.917860)
2 3 42.131638 -76.822420 (42.131638,-76.822420)
Note: I apologize, For some reason the table above is not formatting properly.