I have a dataframe like this (note: C is the count of values in A):
A B C
ex, one, two, three X1 4
ex, one, two X2 3
one, two, four X3 3
ex, three X4 2
four, ex X5 2
four, one X6 2
I want to delete all rows in which the value in column A is a subset of another value in column A. So the result should look like
A B C
ex, one, two, three X1 4
one, two, four X3 3
four, ex X5 2
I tried the following approach:
dataframe[np.sum(np.array([[y in x for x in dataframe.A.values] for y in dataframe.A.values]),1)==1]
However, this only filters out values that have the same order, e.g. "ex, one, two" and "ex, one, two, three" but not "ex, two, three".
Looking for help :)