0

I have a data set consisting of Date, Latitude, Longitude. On some days there are multiple Lat/Lon values on the same day. I'm looking for a way (either numpy or pandas or xarray) to change the structure so I have the Dates as an index and when I choose a single date I get a list of the Lat/Lon values from that Date. The idea is to be asle to neatly plot location by day.

I appreciatwe any ideas you might have. The df currently looks like this:

       Date        Lat        Lon

623 01/04/2023 32.889517 34.724117 624 01/04/2023 32.889550 34.724133 625 01/04/2023 32.889617 34.724183 626 01/04/2023 32.889700 34.724200 627 01/04/2023 32.890033 34.724250 .. ... ... ... 618 31/03/2023 32.856350 34.710267 619 31/03/2023 32.856700 34.710283 620 31/03/2023 32.856700 34.710300 621 31/03/2023 32.856700 34.710300 622 31/03/2023 32.857017 34.710350

I tried using pandas series:

Date=pd.Series(Times) Lat=pd.Series(lat,index=Date)

I tried with pd.sort_values(['Date', 'Lat'], inplace=True)

In both instance I got multiple entries of dates with the corresponding Lat/Lon values. I'm looking for perhaps Dates as columns with Lat and Lon as rows.

Thanks

0 Answers0