-1

I have dataframe like this

 name    cat1    cat2    cat3
'aa bb'    A      A-1   A-1-1
'cc dd'    B      B-1   B-1-1
'ee aa'    C      C-1   C-1-1
'gg bb'    D      D-1   D-1-1

I want to make dataFrame of that dataframe that includes aa like this

 name    cat1    cat2    cat3
'aa bb'    A      A-1   A-1-1
'ee aa'    C      C-1   C-1-1
miladjurablu
  • 91
  • 1
  • 6

1 Answers1

0

Use the str methods of the pandas series to perform string operations, including checking whether the strings contain a certain substring:

df.loc[df.name.str.contains("aa")]
mcsoini
  • 6,280
  • 2
  • 15
  • 38