0

Assume that I have a dataframe as below

Name Language
Tom  Japanese
Rose Japanese
……
Jack Chinese
Jack Japanese
Mike Japanese
Mike French

I want to leave the people who only speak Japanese but not speak others by checking the language column and get the output like:

Name Language
Tom  Japanese
Rose Japanese

Jack and Mike speak 2 languages so I only want to keep Tom and Rose.

1 Answers1

1

Assuming your dataframe is called df. The following code will set the df equal to where the Language column equals Japanese.

df = df[df['Language'] == 'Japanese']
Brian
  • 2,163
  • 1
  • 14
  • 26