I am trying to remove rows with an specific string only on a column, in a dataframe.
I tought of using a combination of drop and iloc methods, because the column names are rather large and mutable and I am not interested in referencing the columns by name, but I am not being able to combine those two into a function containing the string parameter.
As an example, let's say I have the following dataframe:
Nome Nota
0 a 1.000000
1 b 1.250000
2 c 1.375000
3 d 1.437500
4 e 1.468750
5 f 1.484375
6 g 1.492188
7 h 1.496094
8 i 1.498047
9 j 1.499023
10 k 1.499512
11 l 1.499756
12 m 1.499878
13 n 1.499939
14 o 1.499969
15 p 1.499985
16 q 1.499992
17 r 1.499996
18 s 1.499998
Let's say I would like to drop every row containing the 'm' string on the first column. I tried using the function:
testdf.drop(testdf.columns[0] == 'm',inplace = True)
but it gave me the error message:
'KeyError: '[False] not found in axis'.
What am I getting wrong here?