How do I find the indices of DataFrame entries containing specific strings and these strings are not column names.
indice0 = np.argwhere(df=='apple')
indice1 = np.argwhere(df=='banna')
indice2 = np.argwhere(df=='orange')
I know that the code above works, but is there a way that I can simplify this like using a for loop. And it seems like the code above doesn’t work if I just know part of a string, for example
indice0 = np.argwhere(df=='pple')
indice1 = np.argwhere(df=='anna')
indice2 = np.argwhere(df=='range'
Are there other ways to locate the indices?