I have a dataframe that looks like:
import pandas as pd
df1 = pd.DataFrame({'Counterparty':['Bank','Client','Bank','Bank'],
'Amount':[100, 100, 100, 100]
})
I want to have a flexible selection that uses a string to filter out certain records. Something like:
condition ="'Bank'"
result = "df1['Counterparty'].isin(["+condition+"])"
print(eval(result))
I am struggling how to select all records that are NOT with Counterparty =Bank . ie
condition ="Not("Bank"))"
Any suggestions how I can achieve this ?