Expand Menu
-
Home / Documentation / vDataFrame / Main Methods / Cov
vDataFrame.cov¶
In [ ]:
vDataFrame.cov(columns: list = [],
focus: str = "",
show: bool = True,
ax=None,
**style_kwds,)
Computes the Covariance Matrix of the vDataFrame.
Parameters¶
Name | Type | Optional | Description |
---|---|---|---|
columns | list | ✓ | List of the vcolumns names. If empty, all the numerical vcolumns will be used. |
cmap | str | ✓ | Color Map. |
focus | str | ✓ | Focus the computation on only one vcolumn. |
show | bool | ✓ | If set to True, the Covariance Matrix will be drawn using Matplotlib.. |
ax | Matplotlib axes object | ✓ | The axes to plot on. |
**style_kwds | Matplotlib axes object | ✓ | Any optional parameter to pass to the Matplotlib functions. |
Returns¶
tablesample : An object containing the result. For more information, see utilities.tablesample.
Example¶
In [43]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
display(titanic)
123 pclassInt | 123 survivedInt | Abc Varchar(96) | Abc genderChar(1) | 123 ageNumeric(6,3) | 123 sibspInt | 123 parchInt | Abc ticketVarchar(24) | 123 fareNumeric(7,4) | Abc cabinChar(10) | Abc embarkedChar(1) | Abc boatChar(4) | 123 bodyInt | Abc homedestVarchar(64) | 123 splitFloat | |
1 | 1 | 0 | f | 2.000 | 1 | 2 | 113781 | 151.5500 | C22 C26 | S | [null] | [null] | Montreal, PQ / Chesterville, ON | 0.663092836970463 | |
2 | 1 | 0 | m | 30.000 | 1 | 2 | 113781 | 151.5500 | C22 C26 | S | [null] | 135 | Montreal, PQ / Chesterville, ON | 0.161721162730828 | |
3 | 1 | 0 | f | 25.000 | 1 | 2 | 113781 | 151.5500 | C22 C26 | S | [null] | [null] | Montreal, PQ / Chesterville, ON | 0.527904006186873 | |
4 | 1 | 0 | m | 39.000 | 0 | 0 | 112050 | 0.0000 | A36 | S | [null] | [null] | Belfast, NI | 0.936014187755063 | |
5 | 1 | 0 | m | 71.000 | 0 | 0 | PC 17609 | 49.5042 | [null] | C | [null] | 22 | Montevideo, Uruguay | 0.40874306159094 | |
6 | 1 | 0 | m | 47.000 | 1 | 0 | PC 17757 | 227.5250 | C62 C64 | C | [null] | 124 | New York, NY | 0.0771260927431285 | |
7 | 1 | 0 | m | [null] | 0 | 0 | PC 17318 | 25.9250 | [null] | S | [null] | [null] | New York, NY | 0.360885151894763 | |
8 | 1 | 0 | m | 24.000 | 0 | 1 | PC 17558 | 247.5208 | B58 B60 | C | [null] | [null] | Montreal, PQ | 0.78418595273979 | |
9 | 1 | 0 | m | 36.000 | 0 | 0 | 13050 | 75.2417 | C6 | C | A | [null] | Winnipeg, MN | 0.392075354699045 | |
10 | 1 | 0 | m | 25.000 | 0 | 0 | 13905 | 26.0000 | [null] | C | [null] | 148 | San Francisco, CA | 0.760954634286463 | |
11 | 1 | 0 | m | 45.000 | 0 | 0 | 113784 | 35.5000 | T | S | [null] | [null] | Trenton, NJ | 0.083728444064036 | |
12 | 1 | 0 | m | 42.000 | 0 | 0 | 110489 | 26.5500 | D22 | S | [null] | [null] | London / Winnipeg, MB | 0.187408909434453 | |
13 | 1 | 0 | m | 41.000 | 0 | 0 | 113054 | 30.5000 | A21 | S | [null] | [null] | Pomeroy, WA | 0.464197367895395 | |
14 | 1 | 0 | m | 48.000 | 0 | 0 | PC 17591 | 50.4958 | B10 | C | [null] | 208 | Omaha, NE | 0.989756429567933 | |
15 | 1 | 0 | m | [null] | 0 | 0 | 112379 | 39.6000 | [null] | C | [null] | [null] | Philadelphia, PA | 0.197682256577536 | |
16 | 1 | 0 | m | 45.000 | 0 | 0 | 113050 | 26.5500 | B38 | S | [null] | [null] | Washington, DC | 0.567665293579921 | |
17 | 1 | 0 | m | [null] | 0 | 0 | 113798 | 31.0000 | [null] | S | [null] | [null] | [null] | 0.221641422947869 | |
18 | 1 | 0 | m | 33.000 | 0 | 0 | 695 | 5.0000 | B51 B53 B5 | S | [null] | [null] | New York, NY | 0.738475721329451 | |
19 | 1 | 0 | m | 28.000 | 0 | 0 | 113059 | 47.1000 | [null] | S | [null] | [null] | Montevideo, Uruguay | 0.366747971624136 | |
20 | 1 | 0 | m | 17.000 | 0 | 0 | 113059 | 47.1000 | [null] | S | [null] | [null] | Montevideo, Uruguay | 0.268853009678423 | |
21 | 1 | 0 | m | 49.000 | 0 | 0 | 19924 | 26.0000 | [null] | S | [null] | [null] | Ascot, Berkshire / Rochester, NY | 0.513710137922317 | |
22 | 1 | 0 | m | 36.000 | 1 | 0 | 19877 | 78.8500 | C46 | S | [null] | 172 | Little Onn Hall, Staffs | 0.453328180825338 | |
23 | 1 | 0 | m | 46.000 | 1 | 0 | W.E.P. 5734 | 61.1750 | E31 | S | [null] | [null] | Amenia, ND | 0.169697929639369 | |
24 | 1 | 0 | m | [null] | 0 | 0 | 112051 | 0.0000 | [null] | S | [null] | [null] | Liverpool, England / Belfast | 0.0851756541524082 | |
25 | 1 | 0 | m | 27.000 | 1 | 0 | 13508 | 136.7792 | C89 | C | [null] | [null] | Los Angeles, CA | 0.0152691958937794 | |
26 | 1 | 0 | m | [null] | 0 | 0 | 110465 | 52.0000 | A14 | S | [null] | [null] | Stoughton, MA | 0.916533817071468 | |
27 | 1 | 0 | m | 47.000 | 0 | 0 | 5727 | 25.5875 | E58 | S | [null] | [null] | Victoria, BC | 0.568090511020273 | |
28 | 1 | 0 | m | 37.000 | 1 | 1 | PC 17756 | 83.1583 | E52 | C | [null] | [null] | Lakewood, NJ | 0.627309911651537 | |
29 | 1 | 0 | m | [null] | 0 | 0 | 113791 | 26.5500 | [null] | S | [null] | [null] | Roachdale, IN | 0.747528738109395 | |
30 | 1 | 0 | m | 70.000 | 1 | 1 | WE/P 5735 | 71.0000 | B22 | S | [null] | 269 | Milwaukee, WI | 0.335725951706991 | |
31 | 1 | 0 | m | 39.000 | 1 | 0 | PC 17599 | 71.2833 | C85 | C | [null] | [null] | New York, NY | 0.481107967440039 | |
32 | 1 | 0 | m | 31.000 | 1 | 0 | F.C. 12750 | 52.0000 | B71 | S | [null] | [null] | Montreal, PQ | 0.0527018732391298 | |
33 | 1 | 0 | m | 50.000 | 1 | 0 | PC 17761 | 106.4250 | C86 | C | [null] | 62 | Deephaven, MN / Cedar Rapids, IA | 0.97885028552264 | |
34 | 1 | 0 | m | 39.000 | 0 | 0 | PC 17580 | 29.7000 | A18 | C | [null] | 133 | Philadelphia, PA | 0.157812902005389 | |
35 | 1 | 0 | f | 36.000 | 0 | 0 | PC 17531 | 31.6792 | A29 | C | [null] | [null] | New York, NY | 0.644055349286646 | |
36 | 1 | 0 | m | [null] | 0 | 0 | PC 17483 | 221.7792 | C95 | S | [null] | [null] | [null] | 0.279342690482736 | |
37 | 1 | 0 | m | 30.000 | 0 | 0 | 113051 | 27.7500 | C111 | C | [null] | [null] | New York, NY | 0.767035169992596 | |
38 | 1 | 0 | m | 19.000 | 3 | 2 | 19950 | 263.0000 | C23 C25 C2 | S | [null] | [null] | Winnipeg, MB | 0.490231013158336 | |
39 | 1 | 0 | m | 64.000 | 1 | 4 | 19950 | 263.0000 | C23 C25 C2 | S | [null] | [null] | Winnipeg, MB | 0.235716909635812 | |
40 | 1 | 0 | m | [null] | 0 | 0 | 113778 | 26.5500 | D34 | S | [null] | [null] | Westcliff-on-Sea, Essex | 0.390792083926499 | |
41 | 1 | 0 | m | [null] | 0 | 0 | 112058 | 0.0000 | B102 | S | [null] | [null] | [null] | 0.71977791050449 | |
42 | 1 | 0 | m | 37.000 | 1 | 0 | 113803 | 53.1000 | C123 | S | [null] | [null] | Scituate, MA | 0.114295000443235 | |
43 | 1 | 0 | m | 47.000 | 0 | 0 | 111320 | 38.5000 | E63 | S | [null] | 275 | St Anne's-on-Sea, Lancashire | 0.831041638739407 | |
44 | 1 | 0 | m | 24.000 | 0 | 0 | PC 17593 | 79.2000 | B86 | C | [null] | [null] | [null] | 0.967385483207181 | |
45 | 1 | 0 | m | 71.000 | 0 | 0 | PC 17754 | 34.6542 | A5 | C | [null] | [null] | New York, NY | 0.591355679091066 | |
46 | 1 | 0 | m | 38.000 | 0 | 1 | PC 17582 | 153.4625 | C91 | S | [null] | 147 | Winnipeg, MB | 0.870173128321767 | |
47 | 1 | 0 | m | 46.000 | 0 | 0 | PC 17593 | 79.2000 | B82 B84 | C | [null] | [null] | New York, NY | 0.99003749457188 | |
48 | 1 | 0 | m | [null] | 0 | 0 | 113796 | 42.4000 | [null] | S | [null] | [null] | [null] | 0.403090257197618 | |
49 | 1 | 0 | m | 45.000 | 1 | 0 | 36973 | 83.4750 | C83 | S | [null] | [null] | New York, NY | 0.323395622661337 | |
50 | 1 | 0 | m | 40.000 | 0 | 0 | 112059 | 0.0000 | B94 | S | [null] | 110 | [null] | 0.170912061352283 | |
51 | 1 | 0 | m | 55.000 | 1 | 1 | 12749 | 93.5000 | B69 | S | [null] | 307 | Montreal, PQ | 0.737730374792591 | |
52 | 1 | 0 | m | 42.000 | 0 | 0 | 113038 | 42.5000 | B11 | S | [null] | [null] | London / Middlesex | 0.356435600901023 | |
53 | 1 | 0 | m | [null] | 0 | 0 | 17463 | 51.8625 | E46 | S | [null] | [null] | Brighton, MA | 0.61207019072026 | |
54 | 1 | 0 | m | 55.000 | 0 | 0 | 680 | 50.0000 | C39 | S | [null] | [null] | London / Birmingham | 0.96926672779955 | |
55 | 1 | 0 | m | 42.000 | 1 | 0 | 113789 | 52.0000 | [null] | S | [null] | 38 | New York, NY | 0.536786375567317 | |
56 | 1 | 0 | m | [null] | 0 | 0 | PC 17600 | 30.6958 | [null] | C | 14 | [null] | New York, NY | 0.56807480356656 | |
57 | 1 | 0 | f | 50.000 | 0 | 0 | PC 17595 | 28.7125 | C49 | C | [null] | [null] | Paris, France New York, NY | 0.809493057662621 | |
58 | 1 | 0 | m | 46.000 | 0 | 0 | 694 | 26.0000 | [null] | S | [null] | 80 | Bennington, VT | 0.982430178439245 | |
59 | 1 | 0 | m | 50.000 | 0 | 0 | 113044 | 26.0000 | E60 | S | [null] | [null] | London | 0.696268314495683 | |
60 | 1 | 0 | m | 32.500 | 0 | 0 | 113503 | 211.5000 | C132 | C | [null] | 45 | [null] | 0.267956059193239 | |
61 | 1 | 0 | m | 58.000 | 0 | 0 | 11771 | 29.7000 | B37 | C | [null] | 258 | Buffalo, NY | 0.533579262206331 | |
62 | 1 | 0 | m | 41.000 | 1 | 0 | 17464 | 51.8625 | D21 | S | [null] | [null] | Southington / Noank, CT | 0.596509403316304 | |
63 | 1 | 0 | m | [null] | 0 | 0 | 113028 | 26.5500 | C124 | S | [null] | [null] | Portland, OR | 0.430671361740679 | |
64 | 1 | 0 | m | [null] | 0 | 0 | PC 17612 | 27.7208 | [null] | C | [null] | [null] | Chicago, IL | 0.355260608484969 | |
65 | 1 | 0 | m | 29.000 | 0 | 0 | 113501 | 30.0000 | D6 | S | [null] | 126 | Springfield, MA | 0.0263086690101773 | |
66 | 1 | 0 | m | 30.000 | 0 | 0 | 113801 | 45.5000 | [null] | S | [null] | [null] | London / New York, NY | 0.309636837337166 | |
67 | 1 | 0 | m | 30.000 | 0 | 0 | 110469 | 26.0000 | C106 | S | [null] | [null] | Brockton, MA | 0.0152337534818798 | |
68 | 1 | 0 | m | 19.000 | 1 | 0 | 113773 | 53.1000 | D30 | S | [null] | [null] | New York, NY | 0.364044237649068 | |
69 | 1 | 0 | m | 46.000 | 0 | 0 | 13050 | 75.2417 | C6 | C | [null] | 292 | Vancouver, BC | 0.475262716412544 | |
70 | 1 | 0 | m | 54.000 | 0 | 0 | 17463 | 51.8625 | E46 | S | [null] | 175 | Dorchester, MA | 0.30979929654859 | |
71 | 1 | 0 | m | 28.000 | 1 | 0 | PC 17604 | 82.1708 | [null] | C | [null] | [null] | New York, NY | 0.408943912014365 | |
72 | 1 | 0 | m | 65.000 | 0 | 0 | 13509 | 26.5500 | E38 | S | [null] | 249 | East Bridgewater, MA | 0.478623170405626 | |
73 | 1 | 0 | m | 44.000 | 2 | 0 | 19928 | 90.0000 | C78 | Q | [null] | 230 | Fond du Lac, WI | 0.148798908572644 | |
74 | 1 | 0 | m | 55.000 | 0 | 0 | 113787 | 30.5000 | C30 | S | [null] | [null] | Montreal, PQ | 0.126385363517329 | |
75 | 1 | 0 | m | 47.000 | 0 | 0 | 113796 | 42.4000 | [null] | S | [null] | [null] | Washington, DC | 0.625826764851809 | |
76 | 1 | 0 | m | 37.000 | 0 | 1 | PC 17596 | 29.7000 | C118 | C | [null] | [null] | Brooklyn, NY | 0.980584268225357 | |
77 | 1 | 0 | m | 58.000 | 0 | 2 | 35273 | 113.2750 | D48 | C | [null] | 122 | Lexington, MA | 0.496911391615868 | |
78 | 1 | 0 | m | 64.000 | 0 | 0 | 693 | 26.0000 | [null] | S | [null] | 263 | Isle of Wight, England | 0.189228599891067 | |
79 | 1 | 0 | m | 65.000 | 0 | 1 | 113509 | 61.9792 | B30 | C | [null] | 234 | Providence, RI | 0.280916610732675 | |
80 | 1 | 0 | m | 28.500 | 0 | 0 | PC 17562 | 27.7208 | D43 | C | [null] | 189 | ?Havana, Cuba | 0.485971889225766 | |
81 | 1 | 0 | m | [null] | 0 | 0 | 112052 | 0.0000 | [null] | S | [null] | [null] | Belfast | 0.392282282235101 | |
82 | 1 | 0 | m | 45.500 | 0 | 0 | 113043 | 28.5000 | C124 | S | [null] | 166 | Surbiton Hill, Surrey | 0.0708799788262695 | |
83 | 1 | 0 | m | 23.000 | 0 | 0 | 12749 | 93.5000 | B24 | S | [null] | [null] | Montreal, PQ | 0.089022418949753 | |
84 | 1 | 0 | m | 29.000 | 1 | 0 | 113776 | 66.6000 | C2 | S | [null] | [null] | Isleworth, England | 0.545445928815752 | |
85 | 1 | 0 | m | 18.000 | 1 | 0 | PC 17758 | 108.9000 | C65 | C | [null] | [null] | Madrid, Spain | 0.513165891636163 | |
86 | 1 | 0 | m | 47.000 | 0 | 0 | 110465 | 52.0000 | C110 | S | [null] | 207 | Worcester, MA | 0.164120414061472 | |
87 | 1 | 0 | m | 38.000 | 0 | 0 | 19972 | 0.0000 | [null] | S | [null] | [null] | Rotterdam, Netherlands | 0.431144091999158 | |
88 | 1 | 0 | m | 22.000 | 0 | 0 | PC 17760 | 135.6333 | [null] | C | [null] | 232 | [null] | 0.174215304432437 | |
89 | 1 | 0 | m | [null] | 0 | 0 | PC 17757 | 227.5250 | [null] | C | [null] | [null] | [null] | 0.641582700423896 | |
90 | 1 | 0 | m | 31.000 | 0 | 0 | PC 17590 | 50.4958 | A24 | S | [null] | [null] | Trenton, NJ | 0.814205173403025 | |
91 | 1 | 0 | m | [null] | 0 | 0 | 113767 | 50.0000 | A32 | S | [null] | [null] | Seattle, WA | 0.195884848246351 | |
92 | 1 | 0 | m | 36.000 | 0 | 0 | 13049 | 40.1250 | A10 | C | [null] | [null] | Winnipeg, MB | 0.653516355436295 | |
93 | 1 | 0 | m | 55.000 | 1 | 0 | PC 17603 | 59.4000 | [null] | C | [null] | [null] | New York, NY | 0.10073209204711 | |
94 | 1 | 0 | m | 33.000 | 0 | 0 | 113790 | 26.5500 | [null] | S | [null] | 109 | London | 0.278607521904632 | |
95 | 1 | 0 | m | 61.000 | 1 | 3 | PC 17608 | 262.3750 | B57 B59 B6 | C | [null] | [null] | Haverford, PA / Cooperstown, NY | 0.0629091840237379 | |
96 | 1 | 0 | m | 50.000 | 1 | 0 | 13507 | 55.9000 | E44 | S | [null] | [null] | Duluth, MN | 0.963238372234628 | |
97 | 1 | 0 | m | 56.000 | 0 | 0 | 113792 | 26.5500 | [null] | S | [null] | [null] | New York, NY | 0.462777572218329 | |
98 | 1 | 0 | m | 56.000 | 0 | 0 | 17764 | 30.6958 | A7 | C | [null] | [null] | St James, Long Island, NY | 0.0639691490214318 | |
99 | 1 | 0 | m | 24.000 | 1 | 0 | 13695 | 60.0000 | C31 | S | [null] | [null] | Huntington, WV | 0.0569538441486657 | |
100 | 1 | 0 | m | [null] | 0 | 0 | 113056 | 26.0000 | A19 | S | [null] | [null] | Streatham, Surrey | 0.725290278671309 |
Rows: 1-100 | Columns: 15
In [44]:
titanic.cov()
In [45]:
titanic.cov(focus = "survived")
See Also¶
vDataFrame.acf | Computes the Correlations between a vcolumn and its lags. |
vDataFrame.corr | Computes the Correlation Matrix of the vDataFrame. |
vDataFrame.regr | Computes the Regression Matrix of the vDataFrame. |
(c) Copyright [2020-2022] Vertica