I have a question.
I have a table like this
TAC | Latitude | Longitude
1 | 50.4 | -1.5
In Pandas, I wanted to say:
For each TAC, give me a zipped list of latitude and longitude (each TAC can have many rows).
I've tried things like the below, but I am doing something wrong! Can you help?
df1['coordinates'] = list(zip(df1.Lat, df1.Long))
new_df = df1.iloc[ : , : ].groupby('TAC').agg(df1['coordinates'])
For reference, DF1 is created as below
df = pd.read_csv('tacs.csv')
df1 = df[['magnet.tac','magnet.latitude', 'magnet.longitude']]
df1.columns = ['TAC','Lat','Long']