-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,246
  • 2
  • 17
  • 35

1 Answers1

1

Use Regex pattern boundaries \b

Ex:

df["Col"].str.contains(r"\bScan\b")
Rakesh
  • 78,594
  • 17
  • 67
  • 103