Using Complex Conditions To Form A Pandas Data Frame From The Existing One
I've got the following dataframe containing function names, their arguments, the default values of the arguments and argument types: FULL_NAME ARGUMENT DEF_VALS TYPE 'func
Solution 1:
You can do df = df[df['ARGUMENT'] != 'self'].copy(deep=True)
to remove all the rows with ARGUMENT equal to "self" before apply the solution.
P.S. I am also guessing you only care about remove "self" if it's the first argument, in that case, the appropriate preprocessing step would be
df = df[
~(
(df['ARGUMENT'] == 'self') &
(df.groupby('FULL_NAME').cumcount() == 0)
)
].copy(deep=True)
Post a Comment for "Using Complex Conditions To Form A Pandas Data Frame From The Existing One"