'Fill NULL based on conditions python
I have a dataset, and needs to create a new column to deal with the NULL based on the conditions. Here is the sample data:
id1 id2 col1 col2
1 1 2 3
2 2 2 NULL
3 3 NULL 3
4 4 NULL 3
5 5 10 11
The expect output is
id1 id2 col1 col2 combine
1 1 2 3 2,3
2 2 2 NULL 2,3
3 3 NULL 3 2,3
4 4 NULL 3 2,3
5 5 10 11 10,11
for example,If any col1 and col2 has 2 or 3, the new column need to contain both values.Not sure how to capture if col1 or col2 has NULLs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
