so I'm trying to create a new column that indicates whether or not the specified condition is True. I want the column to simply state "1" or "0".
Here's my code:
data_sub = data_orig.loc[~pd.isnull(data_orig['Last_Audit_Date']), :]
data_sub.reset_index(inplace=True)
data_sub['PackageLengthFlag'] = (abs(data_sub.loc['AUDIT_Primary_Length'] - data_sub.loc[:, 'PKG_SUB_Length']) > threshold)
I am thinking that True = 1 and False = 0 by default, if I convert it into integers, right? (thought I read somewhere saying this...)
And here's the warning that I keep getting:
SettingWithCopyWarning: A value is trying to be set on a copy of
a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
I read into:
How to deal with SettingWithCopyWarning in Pandas?
Correct way to set value on a slice in pandas
But I don't think they do what I am looking for. Anyone has any advice? I know this question may sound painfully stupid, but still appreciate any help!
Edit I've added the 2 lines of code where I created the data_sub. Hope that helps!