Filling data in Pandas

I'm using pandas and i have a little data like that.

4     1
5     8
6    25
7    33
8    24
9     4

and I want to fill in missing parts. I want to like that :

1     0
2     0
3     0
4     1
5     8
6    25
7    33
8    24
9     4
10    0

It's gonna be a list for use. like that [0,0,0,1,8,25,33,24,4,0] looked for a solution but couldn't find any. Any idea?

Upvotes: 1

Views: 86

Answers (1)

BENY
BENY

Reputation: 323226

Try with reindex

l = s.reindex(range(10+1),fill_value=0).tolist()

Upvotes: 3

Related Questions