如何用特定范围内的值填充DataFrame中缺少的行?

时间:2019-04-13 08:36:34

标签: python python-3.x pandas dataframe

我缺少DataFrame中的某些行,我的date_number范围从0到50。我想创建丢失的行,在这种情况下,它丢失了从0到13以及从29到50的范围我希望每一个丢失的地方都充满以下数据:

date_number tag_id    price weekday brand_id  sales  stock  profit
XX.X        665237982.0 12. Y.Y     2123.0        0.0  0.0    0.00
date_number tag_id    price weekday brand_id  sales  stock  profit
14.0        665237982.0 12.95 0.0     2123.0        0.0  128.0    0.00
15.0        665237982.0 12.95 1.0     2123.0        9.0  106.0  116.55
16.0        665237982.0 12.95 2.0     2123.0       29.0  137.0  375.55
17.0        665237982.0 12.95 3.0     2123.0       24.0   88.0  310.80
18.0        665237982.0 12.95 4.0     2123.0       27.0   35.0  349.65
19.0        665237982.0 12.95 5.0     2123.0        2.0    2.0   25.90
21.0        665237982.0 12.95 0.0     2123.0       14.0  312.0  181.30
22.0        665237982.0 12.95 1.0     2123.0       12.0  455.0  155.40
23.0        665237982.0 12.95 2.0     2123.0       12.0  450.0  155.40
24.0        665237982.0 12.95 3.0     2123.0        8.0  450.0  103.60
25.0        665237982.0 12.95 4.0     2123.0       11.0  427.0  142.45
26.0        665237982.0 12.95 5.0     2123.0        9.0  401.0  116.55
27.0        665237982.0 12.95 6.0     2123.0       19.0  377.0  246.05
28.0        665237982.0 12.95 0.0     2123.0       12.0  343.0  155.40
29.0        665237982.0 12.95 1.0     2123.0        9.0  314.0  116.55

0 个答案:

没有答案