Data:
A B
0 a d
1 b NaN
2 c c
3 d f
How might I interleave 0-columns between A and B? I'd like to get:
A X B
0 a 0 d
1 b 0 NaN
2 c 0 c
3 d 0 f
Similarly, for this:
A B C
0 a d e
1 b NaN a
2 c c f
3 d f g
I'd like:
A X B X C
0 a 0 d 0 e
1 b 0 NaN 0 a
2 c 0 c 0 f
3 d 0 f 0 g
How can I do this?
You can find my attempt at this below. I'd like to know other, possibly shorter/more efficient/eccentric ways of doing this.