I am trying to assign a value to the Team Name value in the df, I was able to retrieve the value at the cell but when i tried to assign a value to it, it wont reflect the change
Unnamed: 0 Name Email Roll Number Phone Number Discord Id Team Name
0 0 Name [email protected] 1025 9821090000 discordid#4431 NaN
register[register['Discord Id'] == 'discordid#4431']['Team Name']
gives the output
0 NaN
Name: Team Name, dtype: float64
register[register['Discord Id'] == 'discordid#4431']['Team Name'] = 'Team1'
does not reflect any changes
in the dataframe
can anybody help?
CodePudding user response:
Try
mask = register['Discord Id'] == 'discordid#4431'
register.loc[mask, 'Team Name'] = 'Team1'
CodePudding user response:
Is this what you're trying to do?
df['Team Name'] = df['Discord ID']