If else statement not working

i am working on a dataframe and in it an if else loop is not working. the code is as below
X[‘native-country’]=[“Thailand” if x==‘Thailand’ else ‘others’ for x in X[‘native-country’] ]

print(X[‘native-country’].value_counts().sort_values(ascending=False))

the column ‘native-country’ in the dataframe has atleast 20 instances of Thailand and hence i should expect if statement to be evaluated, but it is showing the result only for else statement. what could be the reason

>>> X = {}
>>> X['native_country'] = [ 'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand',
  'Thailand' ]
>>> [x if x=='Thailand' else 'others' for x in X['native_country']]
['Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand', 'Thailand']
>>> 

Not really sure what this is supposed to mean, though. Is the assignment supposed be back onto the original object?

I have a csv file and i have got a dataframe from it.one of the cols in it is native-country and has many country names . by using the df['native-country].value_counts(), i get the frequency of each country in the data. i find that us has the maximum frequency as others (90% are us). So i would like to classify countries apart from US as others and only US as USA. towards it i wrote this code:

X[‘native-country’]=[[‘United-States’, if x==‘Thailand’ else ‘others’ for x in X[‘native-country’]]

print(X[‘native-country’].value_counts().sort_values(ascending=False))

I get evaluated as all the countries are others and no country belong to US. So how do i resolve

This is a bit out of my wheelhouse so you may have to ring up a coach or advisor for guidance. Given the context above I cannot make much out of it beyond testing the comprehension.