vDataFrame.cdt

In [ ]:
vDataFrame.cdt(columns: list = [],
               max_cardinality: int = 20,
               nbins: int = 10,
               tcdt: bool = True,)

Returns the complete disjunctive table of the vDataFrame. Numerical features are transformed to categorical using the 'discretize' method. Applying PCA on TCDT leads to MCA (Multiple correspondence analysis).

⚠ Warning: This method can become computationally expensive when used with categorical variables with many categories.

Parameters

Name Type Optional Description
columns
list
List of the vColumns names.
max_cardinality
int
For any categorical variable, keeps the most frequent categories and merges the less frequent categories into a new unique category.
nbins
int
Number of bins used for the discretization (must be > 1).
tcdt
list
If set to True, returns the transformed complete disjunctive table (TCDT).

Returns

vDataFrame : the CDT relation.

Example

In [11]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
titanic.cdt(tcdt=False)


Out[11]:
123
pclass_1
Bool
100%
123
pclass_2
Bool
100%
123
pclass_3
Bool
100%
123
survived_0
Bool
100%
123
survived_1
Bool
100%
123
name_Andrews__Mr._Thomas_Jr
Bool
100%
123
name_Baclini__Miss._Eugenie
Bool
100%
123
Bool
100%
123
Bool
100%
123
name_Connolly__Miss._Kate
Bool
100%
123
Bool
100%
123
name_Denbury__Mr._Herbert
Bool
100%
123
Bool
100%
123
name_Kelly__Mr._James
Bool
100%
123
name_Kenyon__Mr._Frederick_R
Bool
100%
123
name_Leitch__Miss._Jessie_Wills
Bool
100%
123
Bool
100%
123
Bool
100%
123
name_Nenkoff__Mr._Christo
Bool
100%
123
name_Newell__Miss._Marjorie
Bool
100%
123
name_Others
Bool
100%
123
name_Pavlovic__Mr._Stefo
Bool
100%
123
name_Rice__Master._Arthur
Bool
100%
123
name_Shaughnessy__Mr._Patrick
Bool
100%
123
Bool
100%
...
123
body_[297;329]
Bool
100%
123
body_[33;65]
Bool
100%
123
body_[66;98]
Bool
100%
123
body_[99;131]
Bool
100%
123
home.dest_Austria
Bool
100%
123
home.dest_Belfast
Bool
100%
123
home.dest_Brooklyn__NY
Bool
100%
123
home.dest_Bulgaria_Chicago__IL
Bool
100%
123
home.dest_Cornwall___Akron__OH
Bool
100%
123
Bool
100%
123
home.dest_London
Bool
100%
123
home.dest_London__England
Bool
100%
123
home.dest_Minneapolis__MN
Bool
100%
123
home.dest_Montreal__PQ
Bool
100%
123
home.dest_New_York__NY
Bool
100%
123
home.dest_Others
Bool
100%
123
home.dest_Paris___Haiti
Bool
100%
123
home.dest_Paris__France
Bool
100%
123
home.dest_Philadelphia__PA
Bool
100%
123
home.dest_San_Francisco__CA
Bool
100%
123
Bool
100%
123
home.dest_Sweden_Winnipeg__MN
Bool
100%
123
home.dest_Sweden_Worcester__MA
Bool
100%
123
Bool
100%
123
home.dest_Winnipeg__MB
Bool
100%
1100100000000001000...0000000000000010000000
2100100000000001000...0000000000000010000000
3100100000000001000...0000000000000010000000
4100101000000000000...0000000000000010000000
5100100000000001000...0000000000000010000000
6100100000000001000...0001000000000100000000
7100100000000001000...0000000000000100000000
8100100000000001000...0000000000001000000000
9100100000000001000...0000000000000010000000
10100100000000001000...0000000000000000001000
11100100000000001000...0000000000000010000000
12100100000000001000...0000000000000010000000
13100100000000001000...0000000000000010000000
14100100000000001000...0000000000000010000000
15100100000000001000...0000000000000000010000
16100100000000001000...0000000000000010000000
17100100000000001000...0000000000000010000000
18100100000000001000...0000000000000100000000
19100100000000001000...0000000000000010000000
20100100000000001000...0000000000000010000000
21100100000000001000...0000000000000010000000
22100100000000001000...0000000000000010000000
23100100000000001000...0000000000000010000000
24100100000000000000...0000000000000010000000
25100100000000001000...0000000000000010000000
26100100000000001000...0000000000000010000000
27100100000000001000...0000000000000010000000
28100100000000001000...0000000000000010000000
29100100000000001000...0000000000000010000000
30100100000000001000...0000000000000010000000
31100100000000001000...0000000000000100000000
32100100000000001000...0000000000001000000000
33100100000000001000...0100000000000010000000
34100100000000001000...0000000000000000010000
35100100000000001000...0000000000000100000000
36100100000000001000...0000000000000010000000
37100100000000001000...0000000000000100000000
38100100000000001000...0000000000000000000001
39100100000000001000...0000000000000000000001
40100100000000001000...0000000000000010000000
41100100000000001000...0000000000000010000000
42100100000000001000...0000000000000010000000
43100100000000001000...0000000000000010000000
44100100000000001000...0000000000000010000000
45100100000000001000...0000000000000100000000
46100100000000001000...0000000000000000000001
47100100000000001000...0000000000000100000000
48100100000000001000...0000000000000010000000
49100100000000001000...0000000000000100000000
50100100000000001000...0001000000000010000000
51100100000000001000...1000000000001000000000
52100100000000001000...0000000000000010000000
53100100000000001000...0000000000000010000000
54100100000000001000...0000000000000010000000
55100100000000001000...0100000000000100000000
56100100000000001000...0000000000000100000000
57100100000000001000...0000000000000010000000
58100100000000001000...0010000000000010000000
59100100000000001000...0000000001000000000000
60100100000000001000...0100000000000010000000
61100100000000001000...0000000000000010000000
62100100000010000000...0000000000000010000000
63100100000000001000...0000000000000010000000
64100100000000001000...0000000000000010000000
65100100000000001000...0001000000000010000000
66100100000000001000...0000000000000010000000
67100100000000001000...0000000000000010000000
68100100000000001000...0000000000000100000000
69100100000000001000...0000000000000010000000
70100100000000001000...000000000000001