Reputation: 741
I have a Pandas DataFrame df
which relates to the non-trivial part of data: df.head()
spits
item_cnt_month
ID
2 0.441488
5 0.461178
6 0.262789
10 2.861585
14 3.616117
I know that the final DataFrame has to be of size 214200 and thus I want to put the missing IDs with corresponding item_cnt_month
equal to zero . How to do it?
Upvotes: 3
Views: 1063
Reputation: 862581
I believe you need:
df = df.reindex(np.arange(214200), fill_value=0)
Upvotes: 4