Python 中 corr_matrix[TARGET_L].sort_values(ascending=False) 的 R 编程等价物是什么?

问题描述 投票:0回答:1

我想检查输入变量与目标变量的相关性。 Python 中 corr_matrix[TARGET_L].sort_values(ascending=False) 的 R 编程等价物是什么?

我已经尝试过 Hmisc 包和correlation_table(df, TARGET_L),它给出了错误“correlation_table(df, TARGET_F) 中的错误: 找不到函数“correlation_table”。

python r correlation
1个回答
0
投票

没有

df[colnames(df) != "TARGET_BAD_FLAG"]
,我能够实现以下功能:
corr_to_TARGET_BAD_FLAG <- cor(df[sapply(df,is.numeric)], df$TARGET_BAD_FLAG, use = "pairwise.complete.obs")

© www.soinside.com 2019 - 2024. All rights reserved.