'Why do I see a table and not only avg value when I call vDataFrame.count

This is my Jupyter code for a code written for VerticaPy - https://www.vertica.com/python/documentation_last/vdataframe/statistics.php

I have created a vDataFrame for a table and want to find avg of a column

import vertica_python
conn_info = {'host': '127.0.0.1',
             'port': 5433,
             'user': 'dbadmin',
             'password': '',
             'database': 'kaggle_titanic'}


vdf_table = vDataFrame("titanic_train_flex_view")
mean = vdf_table["age"].mean
mean

I expect to see one value of mean but I see the table itself. Why do I not see just one value of mean?

<bound method vColumn.avg of         age  
1      22.0  
2      38.0  
3      26.0  
4      35.0  
5      35.0  
6      None  
7      54.0  
8       2.0  
9      27.0  
10     14.0  
11      4.0  
12     58.0  
13     20.0  
14     39.0  
15     14.0  
16     55.0  
17      2.0  
18     None  
19     31.0  
20     None  
21     35.0  
22     34.0  
23     15.0  
24     28.0  
25      8.0  
26     38.0  
27     None  
28     19.0  
29     None  
30     None  
31     40.0  
32     None  
33     None  
34     66.0  
35     28.0  
36     42.0  
37     None  
38     21.0  
39     18.0  
40     14.0  
41     40.0  
42     27.0  
43     None  
44      3.0  
45     19.0  
46     None  
47     None  
48     None  
49     None  
50     18.0  
51      7.0  
52     21.0  
53     49.0  
54     29.0  
55     65.0  
56     None  
57     21.0  
58     28.5  
59      5.0  
60     11.0  
61     22.0  
62     38.0  
63     45.0  
64      4.0  
65     None  
66     None  
67     29.0  
68     19.0  
69     17.0  
70     26.0  
71     32.0  
72     16.0  
73     21.0  
74     26.0  
75     32.0  
76     25.0  
77     None  
78     None  
79     0.83  
80     30.0  
81     22.0  
82     29.0  
83     None  
84     28.0  
85     17.0  
86     33.0  
87     16.0  
88     None  
89     23.0  
90     24.0  
91     29.0  
92     20.0  
93     46.0  
94     26.0  
95     59.0  
96     None  
97     71.0  
98     23.0  
99     34.0  
100    34.0  
...     ...  
Rows: 1-100 of 891 | Column: age | Type: Numeric(6,3)>


Solution 1:[1]

DataFrame.mean is a function, unlike properties like DataFrame.shape. You need to call functions using parentheses, e.g. df.mean()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexey Larionov