I have a dataframe with 5 columns (Participants, duration_1, duration_2, duration_3, duration_4). The "Participant" column has either subjects with the IDCY or IDCO labels. FOr example: IDCY06, IDCO02,IDCY31...etc. I want to create two new dataframes: those with the IDCY and those with IDCO. I have been using the code:
df[df["Participant"].str.contains("IDCY")]
and I keep getting a keyerror code for Participants even though everything is spelled as it should be.
Is there any other method to iterate over rows and to get a new dataframe with the participants that have a set substring?
Thank you.