我有一个 Pandas 数据框,如下所示:
id cat1 cat2 cat3 num1 num2
1 0 WN 29 2003 98
2 1 TX 12 755 76
3 0 WY 11 845 32
4 1 IL 19 935 46
Run Code Online (Sandbox Code Playgroud)
我想找出之间的相关性cat1
和柱cat3
,num1
以及num2
之间或cat1
与num1
和num2
之间或cat2
与cat1, cat3, num1, num2
当我使用df.corr()
它时,会给出数据框中所有列之间的相关性,但我只想查看上面详述的这些选择性列之间的相关性。
我如何在 Python 熊猫中做到这一点?
一千提前感谢您的回答。
我已使用 mongoimport 实用程序将数据从 csv 文件导入到 mongodb,该文件有一百万条记录:
show dbs;
admin 0.000GB
ded 0.305GB
local 0.000GB
visitors 0.000GB
db.ded.find();
Run Code Online (Sandbox Code Playgroud)
为什么ded数据库有0.305GB的数据却没有行?我怎样才能看到这些数据?任何对此的投入都会有很大的帮助。
我在MongoDB中有以下三个集合
fd2k10sample
fd2k16sample
fd2ksample
Run Code Online (Sandbox Code Playgroud)
它们中的每个文档都具有相同的结构,因此没有以下结构问题:
fd2ksample
id cat1 cat2 cat3 cat4
1 doza moza goza hoza
2 beta geta jeta leta
3 huggy muggy guggy luggy
Run Code Online (Sandbox Code Playgroud)
fd2k10sample
id cat1 cat2 cat3 cat4
1 prizzy mizzy tizzy hizzy
2 chuta buta guta tuta
3 befer lefer gefer tefer
Run Code Online (Sandbox Code Playgroud)
fd2k16sample
id cat1 cat2 cat3 cat4
1 poopa doopa hoopa loopa
2 nijjy pijjy hijjy tijjy
3 ufha puhfa duhfa tuhfa
Run Code Online (Sandbox Code Playgroud)
我如何像这样组合它们:
fd2kfullsample
id cat1 cat2 cat3 cat4
1 doza moza goza hoza …
Run Code Online (Sandbox Code Playgroud) C:\PY27\Scripts>pip install --no-cache-dir scipy
Collecting scipy
c:\py27\lib\site-
packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318:
SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name
Indication) extension to TLS is not available on this platform. This may
cause the server to present an incorrect TLS certificate, which can cause
validation failures. You can upgrade to a newer version of Python to solve
this. For more information, see
https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
c:\py27\lib\site-
packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122:
InsecurePlatformWarning: A true SSLContext object is not available. This
prevents urllib3 from configuring SSL …
Run Code Online (Sandbox Code Playgroud)