I have a dataframe with multiple columns. One of the columns, 'TName', has a different track names. I would like to create a new column for my dataframe which has the country of each racetrack.
My code (idk what to do with the last two lines):
austracks = ['Ascot', 'Balnarring']
nztracks = ['Te Aura']
hktracks = ['Sha Tin']
singtracks = ['Singapore']
df['Country'] = df['TName']
(["AUS" for c in austracks] + ["NZ" for c in nztracks] + ["HK" for c in nztracks] + ["SING" for c in nztracks])
Desired dataframe:
TName Country
Ascot AUS
Balnarring AUS
Te Aura NZ
nztracksis assignedNZ,HK, SING? Not onlyNZ?