I've got a problem with a table in Pandas. I have these lines of code to delete rows with 'Pfam' value when it's together with 'SMART' value for the same index (protein accession number).
df_filtered['nunique'] = df_filtered.groupby('protein accession').analysis.transform('nunique')
df_filtered[~((df_filtered['analysis'] == 'Pfam') & (df_filtered['nunique'] > 1))]
But if I want to change something within the table, it is again converting to the state before the above code was executed. This is how the table looked like before the change:
and after I dropped one of the columns:
Ps I've tried to add inplace=True but I got the syntax error.
CodePudding user response:
assign the df_filtered result back to it
df_filtered = df_filtered[~((df_filtered['analysis'] == 'Pfam') & (df_filtered['nunique'] > 1))]