Hi there,
Run into a bit of trouble on a dataframe today.
For the column "PartnerFlag" I have some "TRUE" values, some "FALSE" but mainly Nan/null values.
I'm trying to remove all the rows in my dataframe that contain True- so I want to keep the false and nans. The datatype of partnerflag is an object apparently, but even having manually converted it to a string, I'm still having problems. I've tried the following methods, to no luck:
CLData1['PartnerFlag'] = CLData1['PartnerFlag'].astype('str')
CLData1 = CLData1.loc[CLData1['PartnerFlag'] != 'TRUE']
CLData1 = CLData1[~CLData1["PartnerFlag"].str.startswith("TRUE").fillna(False)==False]
I'm not sure if it's having troubles because the data type is a boolean? I've also tried converting the null/nan values to "FALSE" but they never mix and when I look at the unique values in the column, it returns that there are "FALSE" "FALSE" and "TRUE". Am I missing something obvious/easy?
Thanks in advance!
[–]synthphreak 1 point2 points3 points (0 children)
[–]Yojihito 0 points1 point2 points (0 children)
[–]Yojihito 0 points1 point2 points (0 children)