简体   繁体   English

如何在python中将二维数据帧转换为二维数组?

[英]How to convert a 2D dataframe into a 2D array in python?

I am working on a dataset and I found out the correlation between every pair of features.我正在处理一个数据集,我发现了每对特征之间的相关性。 The 2D data frame looks like this二维数据框看起来像这样

在此处输入图片说明

I have to iterate over all these values to select those values which are greater than some threshold to select important features.我必须遍历所有这些值来选择那些大于某个阈值的值来选择重要的特征。

I think array would be convenient to handle in this case instead.我认为在这种情况下处理数组会很方便。 How to convert this into a 2D array?如何将其转换为二维数组?

It will look somewhat like this:它看起来有点像这样:

在此处输入图片说明

使用dataframe.values :什么df.values基本上做的是,让你没有索引的原始NumPy的ndarray。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM