'Merge Attribute Values in Python
I have an attribute/column called "marital status" that has the following values as options:
- Married-AF-spouse
- Married-civ-spouse
- Never-married
- Married-spouse-absent
- Separated
- Divorced
- Widowed
I want to merge these values and have the following 3 attributes, that then I will convert into asymmetric binary attributes:
- Married (Married-AF-spouse,Married-civ-spouse)
- Never-married
- Not-married (Married-spouse-absent,Separated, Divorced, Widowed)
What function in Python can I use in order to do that? I already imported pandas and lumpy libraries.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
