1

I have a csv file with 3 columns inside as in the picture

enter image description here

I want to get the English and Spanish but ignore the fields that are null in Spanish so my expected output is

enter image description here

any Ideas how to do it ?

programming freak
  • 859
  • 5
  • 14
  • 34

1 Answers1

1

Use DataFrame.dropna with subset for list for test missing values and then remove French column by DataFrame.drop:

df1 = df.dropna(subset=['English','Spanish']).drop(['French'],axis=1).reset_index(drop=True) 

Or if only 3 columns first remove French and then test all columns:

df1 = df.drop(['French'], axis=1).dropna().reset_index(drop=True) 
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252