This data frame consists of a lot of NAN values and in the latter columns, the data is sparse. But I want all the into a single column.
Like this,
Index Seatblock
1 A.B.C.D
2 A.B.C.D
3 A.B.C.D
4 A.B.C.D
5 A.B.C.D
- Remove all NAN values. I tried
dropna
but it basically drops the columns off which also vanishes my sparse data. - Convert them into a single column, either using list or any python built-in function but I'm quite not able to find one.
Would be helpful. Thanks!
EDIT:
This is the output after applying the suggested code.
EDIT:
For example
Index Seatblock1 Seatblock2 Seatblock3
1 a.b.c.d NAN NAN
2 w.r.t.q q.r.y.t NAN
3 p.y.u.i NAN n.b.x.a
OUTPUT has to be:
Index Seatblock1
1 a.b.c.d
2 w.r.t.q
3 p.y.u.i
4 q.r.y.t
5 n.b.x.a
Like this