回复:Col Median(和其他):添加“Where”选项 - 状态更改为:已确认你好@hogi , 谢谢你的建议! 我们已收到您的请求并将予以考虑。
回复:Col Median(和其他):添加“Where”选项 - 状态更改为:Investigating回复:Col Median(和其他人):添加“Where”选项 - 状态更改为:我们喜欢它! (在队列中)@hogi随着我们致力于改进 Where() 子句在整个 JMP 中的使用方式,我们正在密切关注这一点。感谢您的建议!
回复:Col Median(和其他):添加“Where”选项谢谢 :)
Col Median(及其他):添加“哪里”选项☐ 很酷的新功能
☑ 可以帮助很多用户!
☐ 删除“错误”
☐ 很高兴有
☐ 没人需要它
#myTop10_2022
有一系列帖子询问如何限制 Col ...聚合 函数到特定的子集。
计算列平均值,同时限制使用的观测值
JMP10:Col Max() 和 Col Min() 函数返回排除行的数据
Col 函数和 Row 状态
如何使用带有“where”条件的 Col Maximum Formula
排除公式中的数据
应用案例:
- 排除 rows from the aggregation:
Col Max(if(not(excluded()), :weight,.),: sex)
or even shorter (if one doesn't need values in the excluded rows);
Col Max(:weight, :sex, :excluded())
- Benchmark some data with a reference data set (country A in 这 post)
:data / Col Maximum(if(:country="A", :data,.))
从上面的例子可以看出,简单的解决方案是在Col xyz聚合中使用If语句:
col Mean( if(:sex=="M", :weight,.), :age);
col Mean( if(not(excluded()), :weight,.), :age)
问题:
如果子集if条件包含字符串比较,则该方法极其缓慢:
如何使用带有 where 的 Col 最大值公式/M78599
然后,时间与行数成二次方关系,即使对于只有几千个条目的小数据集,计算也只需几秒钟。
对于包含数百万个条目的数据集,这可能需要数月时间(!!!) - 但会因超时而停止,并弹出错误消息。不太好!
我的愿望:
修复错误
甚至更好:
为Col xyz聚合提供附加的where选项
- 它会自动修复时间问题:首先限制数据集,然后应用聚合(--> 速度更快,即使很酷的“col...”加速有错误)
- 这使得子集定义更容易,
你只需要:而不是(*):
col Mean(:weight, :age, where(:sex=="M"))
col Mean(:weight, :age, where(not(excluded())))
计时示例,从此处复制

修正版本 - 在之前的版本中,屏幕截图显示 [ms] 而不是 [s]
更多愿望由
自动化和脚本基础数据分析与建模数据混合和清理数据探索与可视化大规模定制分享和交流结果回复:Col Median(和其他):添加“Where”选项在 Jmp 的未来版本中可用之前,可以通过解决方法将 col 聚合速度加快几个数量级
将数据类型更改为数字 - 或使用数字公式列。
https://community.jmp.com/t5/Discussions/Tips-and-Tricks-best-practice-with-JMP-JSL/td-p/662686
回复:Col Median(及其他):添加“哪里”选项谢谢, @SamGardner 、 @Sarah-Sylvestre ,它现在可以在 JMP18 中使用:)
在将状态更改为已交付之前,您能否检查一下此代码片段中 Where 的用法是否符合预期?
与原始方法相比,速度极其缓慢:(
dt = Open( "$SAMPLE_DATA/Airline Delays.jmp" );
Print("old aproach");
t0 = hptime();
New Column( "max - 1st of month",
Formula( Col Maximum( if(:Day of Month == 1 , :Arrival Delay,.), :Month) )
);
dt << run formulas();
show((hp time()-t0)/1000000); // 0.5s
Print("new aproach - with Where");
t0 = hptime();
New Column( "max - 1st of month",
Formula( Col Maximum( :Arrival Delay, :Month, Where( :Day of Month == 1 ) ) )
);
dt << run formulas();
show((hp time()-t0)/1000000); // 140s
回复:Col Median(及其他):添加“哪里”选项Print("new aproach - with Where, semi-bugfix");
t0 = hptime();
myWhere = Where( :Day of Month == 1 ) ;
Eval (Eval Expr(New Column( "max - 1st of month",
Formula( Col Maximum( :Arrival Delay, :Month, Expr(myWhere) )
))));
dt << run formulas();
show((hp time()-t0)/1000000); // 40s - better but still way too slow ...回复:Col Median(及其他):添加“哪里”选项啊,还没起作用:(
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "max - 1st of month",
Formula( Col Minimum( :weight, :sex, Where( :age ==17 ) ) )
);