I am unsure how to go about this... I have 1 column, 'Status' and another column, 'MultiID'. I am trying to delete all the rows with the Same MultiID, but only if it includes status 'B'.
import pandas as pd # initialise data of lists. data = {'Status':['A', 'B', 'A', 'C', 'C', 'A', 'B', 'A'], 'MultiID': [1, 1, 2, 2, 2, 3, 3, 3]} # Create DataFrame df = pd.DataFrame(data) # Print the output. print(df) Since There's a 'B' in MultiID's 1 and 3, the output should be:
0 A 2 1 C 2 2 C 2