我有两个数据集,例如7月和8月的数据,每个数字表示下订单的数量。
我想比较一下这两组数据,找出它们之间的差异。
主要有三个区别
a) =订单取消(数字存在于左侧数据集中,而不存在于右侧)
b) =新顺序(数字存在于右侧数据集中,但不存在于左侧)
c) =延期订单(两个数据集中都有编号(但右数据集中的编号在后一个月M0存在)
d) =前置(为了简化,我们假设不会发生这种情况)
July August
TypeM09 M10 M11 M12 TypeM09 M10 M11 M12
A 0 1 2 0 A 0 1 2 0
B 1 0 0 0 B 0 0 1 0
C 1 2 0 0 C 0 1 0 0
D 1 2 2 0 D 1 0 0 2
注意-在上面的D类型中,数字2在M10和M11的左侧数据集中出现两次,在M12的右侧数据集中出现一次。由于程序从左到右检查数据,一旦程序发现M12(在左数据集中)中存在M10(在右数据集中),M11(在左数据集中)中的数字实际上被取消,因为在右数据集中没有更多的“自由”数字可供匹配
程序应该是这样的
Type M09 M10 M11 M12
A - no change no change - -
B postponement to M11 - - -
C postponement to M10 cancellation - -
D no change postponement to M11 cancellation -
作为一个输出,我想实现如下目标:
Type Detail Previous month New month
x Postponement M07 M11
x Postponement M08 M12
y Cancellation M08 -
z New order - M12
我仍然没有什么疑问,所以我只能产生中间输出。。 对于A、B、C、D型所提到的示例,请添加更多的说明和所需的输出
相关问题 更多 >
编程相关推荐