I have a have a weird format for some data that I'm stuck working with. it's a csv file that includes a timestamp column, a latitude minutes column which is a float, and longitude minutes column (float). The data does include a starting Latitude and Longitude in degrees as well, but only a starting value. I need to combine the latitude and longitude minutes columns with the starting values and convert to degrees and decimal degrees. I'm stuck with this format.
lat = 45long = 75data = {'time': ['2024-03-27 12:00:00', '2024-03-27 12:00:01', '2024- 03-27 12:00:02', '2024-03-27 12:00:03', '2024-03-27 12:00:04', '2024-03-27 12:00:05' ],'lat_minutes': [ 59.9955, 59.9963, 0.0180, 0.0230, 0.0050, 59.6500 ],'long_minutes': [ 59.0250, 59.0750, 0.0020, 0.1850, 0.0750, 59.075 ]}df = pd.DataFrame(data) time lat_minutes long_minutes0 2024-03-27 12:00:00 59.9955 59.0251 2024-03-27 12:00:01 59.9963 59.0752 2024-03-27 12:00:02 0.0180 0.0023 2024-03-27 12:00:03 0.0230 0.1854 2024-03-27 12:00:04 0.0050 0.0755 2024-03-27 12:00:05 59.6500 59.075
I need the output to make a new column with degrees.decimal format based on adding the minutes column to starting lat and long values accounting for adding a whole degree once teh minutes roll past 60, and subtracting a degree if they are decreasing and pass o going to 59.9999.
output should be this:
time lat_minutes long_minutes Latitude Longitude0 2024-03-27 12:00:00 59.9955 59.025 45.999925 75.98375 1 2024-03-27 12:00:01 59.9963 59.075 45.9999383 75.9845832 2024-03-27 12:00:02 0.0180 0.002 46.00030 76.00033 2024-03-27 12:00:03 0.0230 0.185 46.00383 76.00308 4 2024-03-27 12:00:04 0.0050 0.075 46.00125 76.001255 2024-03-27 12:00:05 59.6500 59.075 45.99416 75.98458