I am trying to compare dataframe column id with string value contract number
JSON file:
[
{
"id": "ee123-abc"
}
]
df = pd.DataFrame.from_dict(data)
contract_num = 'ee123-abc'
if (df.id == contract_num).any():
print("Matching")
else:
print("Not matching")
I tried converting df.c_w_id.astype(str)
, but still the if condition goes to Not Matching. Please advise how to compare a dataframe column with String value.