我正在寻找一个字段中的缺失条目,将其分为两列作为一个分区,然后向前填充缺失的条目。
我有一张桌子:
England Q1 1 Dogs
England Q1 2 Dogs
England Q1 3 Dogs
Germany Q1 1 Dogs
Germany Q2 1 Cats
Germany Q2 2 Cats
France Q1 1 Cats
France Q2 1 Cats
因此,假设我的范围是1-3,对于每个唯一的[Country] [Quarter]组合,我都希望[Number]列中有完整的1,2,3,而[Animal]列会向前填充前一个条目。
我想要的表:
England Q1 1 Dogs
England Q1 2 Dogs
England Q1 3 Dogs
Germany Q1 1 Dogs
Germany Q1 2 Dogs
Germany Q1 3 Dogs
Germany Q2 1 Cats
Germany Q2 2 Cats
Germany Q2 3 Cats
France Q1 1 Cats
France Q1 2 Cats
France Q1 3 Cats
France Q2 1 Cats
France Q2 2 Cats
France Q2 3 Cats
让我知道这是否没有道理!