Gurus, we are looking for a pythonic way (python 2.7) to convert categorical values in a column into binary values into a single new column. Example: In the "Loan_status" column,
Loan_Status
Charged Off
Default
Fully Paid
Current
Does not meet the credit policy. Status:1
Does not meet the credit policy. Status:0
We are trying to make "Charged Off", "Default" into "0", "Fully Paid", "Current" into "1", and delete any row that contains "Does not meet the credit policy. Status:1" and "Does not meet the credit policy. Status:0".
Desired Output:
Loan_Status
0
0
1
1
Is there any pythonic way to do it? Pandas get_dummies will generate multiple columns, so it doesn't seem to work. Thanks!