vDataFrame[].quantile

In [ ]:
vDataFrame[].quantile(x: float, 
                      approx: bool = True)

Aggregates the vcolumn using an input 'quantile'.

Parameters

Name Type Optional Description
x
float
Number representing the quantile. It must be a float between 0 and 1. For example 0.25 will return Q1.
approx
bool
If set to True, the approximate quantile is returned. By setting this parameter to False, the function's performance can drastically decrease.

Returns

float : quantile (or approximate quantile).

Example

In [6]:
from verticapy.datasets import load_market
market = load_market()
display(market)
Abc
Form
Varchar(32)
Abc
Name
Varchar(32)
123
Price
Float
1Beefsteak,Tomatoes3.15921213872
2BoiledSpinach3.8265942203
3BoiledSpinach3.83371571139
4CannedArtichoke3.3174627313
5CannedArtichoke3.38561047493
6CannedAsparagus2.5802971683
7CannedAsparagus2.7200086787
8CannedBeets0.9427311158
9CannedBeets1.01727546324
10CannedBlack beans0.945681045
11CannedBlack beans0.980579717755
12CannedBlackeye peas0.910440813422
13CannedBlackeye peas0.9310398825
14CannedCarrots0.9231914223
15CannedCarrots1.06049032785
16CannedCollard greens0.8534190293
17CannedCollard greens0.902593822572
18CannedCorn0.8537281609
19CannedCorn0.903905336945
20CannedGreat northern beans0.8733322508
21CannedGreat northern beans0.923915876218
22CannedGreen beans0.824040727
23CannedGreen beans0.826939082717
24CannedGreen peas0.9870138533
25CannedGreen peas1.01306918204
26CannedKale1.0686461381
27CannedLima beans1.3282126206
28CannedLima beans1.3835692655
29CannedMixed Vegetables1.10743317098
30CannedMixed Vegetables1.1153572418
31CannedMixed Vegetables1.1300407331
32CannedMixed Vegetables1.32442847693
33CannedMustard greens0.8227393425
34CannedMustard greens0.976791582056
35CannedNavy beans0.9462506636
36CannedNavy beans0.970423315186
37CannedPinto beans0.8013951325
38CannedPinto beans0.866189704098
39CannedPotatoes0.9031082713
40CannedPotatoes0.965992955381
41CannedPumpkin1.35228040942
42CannedPumpkin1.3781292617
43CannedRed Kidney Beans0.861913772
44CannedRed Kidney Beans0.901679904473
45CannedSpinach1.1345923224
46CannedSpinach1.1471519614
47CannedTomatoes0.912876896
48CannedTomatoes0.924836358886
49CannedTurnip greens0.7843472032
50CannedTurnip greens0.965253514158
51Canned,Olives4.18683171458
52Canned,Olives5.0861220216
53Canned, packed in syrup or waterCherries3.51874337733
54Canned, packed in syrup or waterCherries3.7259182628
55Cooked wholeCarrots0.741539992379
56Cooked wholeCarrots0.7737514155
57DriedApricots7.3309645323
58DriedApricots7.73397208999
59DriedBlack beans1.4038762924
60DriedBlack beans1.48978420263
61DriedBlackeye peas1.58990085218
62DriedBlackeye peas1.613022434
63DriedCranberries4.6894038279
64DriedCranberries4.78674137766
65DriedDates4.79135143479
66DriedDates5.5117046698
67DriedFigs5.7483176391
68DriedFigs6.1253708776
69DriedGreat northern beans1.53402874163
70DriedGreat northern beans1.5891818482
71DriedLentils1.3850358051
72DriedLentils1.5614348422
73DriedLima beans1.73065564313
74DriedLima beans2.2195369395
75DriedMangoes8.50464930168
76DriedMangoes10.1637125484
77DriedNavy beans1.4787507743
78DriedNavy beans1.50577973442
79DriedPapaya4.56591253937
80DriedPapaya5.2722599372
81DriedPineapple5.49708634567
82DriedPineapple5.8687608122
83DriedPinto beans1.085109083
84DriedPinto beans1.20380752717
85DriedRed Kidney Beans1.67188888931
86DriedRed Kidney Beans1.6865123081
87Dried (Prunes)Plums4.03634516164
88Dried (Prunes)Plums4.7339261696
89FloretsBroccoli2.3624557989
90FloretsBroccoli2.56847143403
91FloretsCauliflower3.1279734694
92FloretsCauliflower3.27064843515
93FreshAcorn squash1.1193087167
94FreshAcorn squash1.1722478842
95FreshApples1.56751539145
96FreshApples1.6155336441
97FreshApricots3.0400719671
98FreshApricots3.087137817
99FreshArtichoke2.21305047929
100FreshArtichoke2.3637333814
Rows: 1-100 | Columns: 3
In [7]:
# Approx quantile
market["Price"].quantile(x = 0.5, approx=False)
Out[7]:
1.566898080825
In [8]:
# Exact quantile
market["Price"].quantile(x = 0.5, approx=False)
Out[8]:
1.566898080825

See Also

vDataFrame.aggregate Computes the vDataFrame input aggregations.