How do I combine a lot of columns in Pandas?
I Have 20 Columns that i want to turn in just one
Exemple above w/ 4 Columns:
ID | Type | AB1 | AB2 | AB3 | AB4 |
---|---|---|---|---|---|
0 | True | AA | CC | NAN | ZZ |
1 | False | BB | NAN | HH | JU |
I Want to Turn it in:
ID | Type | AB |
---|---|---|
0 | True | AA |
1 | False | BB |
2 | True | CC |
3 | False | HH |
4 | True | ZZ |
5 | False | JU |
Does anyone has a tip?
Need a way to preserve the "Type"
Thank you!