-1

I'm looking for a cell in a data frame that contains the word "Scan". Unfortunately, there is also a word "Scan-Steuerung" which I would like to ignore. How can I do this in python?

Is it also possible to get the index of this cell?

I'm looking for a cell in a data frame that contains the word "Scan". Unfortunately, there is also a word "Scan-Steuerung" which I would like to ignore. How can I do this in python?

Is it also possible to get the index of this cell?

edit: I think it would be sufficient when I can read these two lines separately. At the moment, I use:

line = df[df["Name:"].str.contains("Scan")]

and when I print, I receive both lines at once.

Ben
  • 1,432
  • 4
  • 20
  • 43

1 Answers1

1

Use Regex pattern boundaries \b

Ex:

df["Col"].str.contains(r"\bScan\b")
Rakesh
  • 81,458
  • 17
  • 76
  • 113