I am currently following the answer here. It mostly worked but when I viewed the whole dataframe, I saw that there are columns that contains 'NaN' values in between columns that do contain a value.
For example I keep getting a result of something like this:
ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
300 1001|1001|1002| NaN | NaN | NaN |1001|1002| NaN | NaN | NaN
301 1010|1010|NaN | NaN | 1000 | 2000|1234| NaN| NaN | 1213 | 1415
302 1100|1234|5678| 9101 | 1121 | 3141|2345|6789| 1011 | 1617 | 1819
303 1000|2001|9876| NaN | NaN | NaN |1001|1002| NaN | NaN | NaN
Is there a way to remove those cells that contains NaN such that the output would be like this:
ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
300 1001|1001|1002| 1001| 1002 | NaN |NaN | NaN| NaN | NaN | NaN
301 1010|1010|1000| 2000| 1234 | 1213|1415| NaN| NaN | NaN | NaN
302 1100|1234|5678| 9101| 1121 | 3141|2345|6789| 1011 | 1617 | 1819
303 1000|2001|9876| 1001| 1002 | NaN |NaN |NaN | NaN | NaN | NaN