0

I have a dataframe with number of columns and hundreds lines.

What would be the simple and best performance way to find all lines in DataFrame where cell in columns my_columns has a substring : abc

PacketLoss
  • 5,561
  • 1
  • 9
  • 27
OcMaRUS
  • 329
  • 3
  • 13
  • 2
    Welcome to Stack Overflow. Its required here to show what you've tried in order to seek assistance, like a code sample. See more here [How to ask](https://stackoverflow.com/help/how-to-ask) – Moha369 Sep 30 '20 at 12:51

2 Answers2

0

Check the best answer here: How to select rows from a DataFrame based on column values? , it's all explained

print(df.loc[df['my_column'] == 'abc'])
0

try :

df[df['my_columns'].str.contains('abc')]
Subasri sridhar
  • 809
  • 5
  • 13