1

I have a excel file with different columns. I want to only show the lines that contain the word 'DUC' in the Column 'Comentário' .

df = pd.read_excel('lista1.xlsx')
coment = df['Comentário']
duc = coment.str.contains("DUC") 
df[df['Comentário'] = coment.str.contains("DUC")] 
  • Add an example of your dataset in text format, mostly 5 - 10 rows is enough, we cannot run or see `lista1.xlsx`. Besides that, I think you want `df[df['Comentário'].str.contains('DUC')]`, so for now I will close it as a duplicate. – Erfan Mar 09 '20 at 17:05

1 Answers1

0

That should do the trick:

print(df[df['Comentário'].str.contains("DUC")])
Gamopo
  • 1,600
  • 1
  • 14
  • 22