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
