Home > other >  How can i print only index values as a list ? from below line
How can i print only index values as a list ? from below line

Time:06-11

This line is giving me all columns of my file. I am trying to print only price list(index only which contains med) of this line.

df.loc[df['price'].str.contains("med")]

CodePudding user response:

What about:

df.index[df['price'].str.contains("med")]

CodePudding user response:

You can try

df[df['price'].str.contains("med")].index
  • Related