vDataFrame.search

In [ ]:
vDataFrame.search(conditions = "",
                  usecols: list = [],
                  expr: list = [],
                  order_by = [])

Searches for elements that match the input conditions. This method will return a new vDataFrame.

Parameters

Name Type Optional Description
conditions
str / list
Filters of the search. It can be a list of conditions or an expression.
usecols
list
vcolumns to select from the final vDataFrame relation. If empty, all the vcolumns will be selected.
expr
list
List of customized expressions. It must be pure SQL. For example, it is possible to write 'column1 * column2 AS my_name'.
order_by
dict / list
List of the vcolumns to use to sort the data using asc order or dictionary of all the sorting methods. For example, to sort by "column1" ASC and "column2" DESC, write {"column1": "asc", "column2": "desc"}

Returns

vDataFrame : vDataFrame of the search

Example

In [66]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
# Looking at the family size and survival of the passengers having
# more than 50 years old who paid the most expensive fares
titanic.search(conditions = ["age > 50"],
               usecols = ["fare", "survived"],
               expr = ["parch + sibsp + 1 AS family_size"],
               order_by = {"fare": "desc"})
123
fare
Numeric(10,5)
123
survived
Int
123
family_size
Int
1512.3292012
2263.0000016
3263.0000006
4262.3750005
5221.7792002
6221.7792002
7164.8667003
8153.4625012
9146.5208011
10146.5208002
11135.6333011
12113.2750003
1393.5000013
1493.5000003
1583.1583012
1683.1583013
1781.8583013
1881.8583013
1980.0000011
2079.6500003
2179.2000013
2278.8500012
2378.2667012
2478.2667012
2577.9583012
2677.9583012
2777.2875002
2876.2917011
2975.2500012
3075.2500002
3171.0000003
3261.9792002
3361.3792002
3459.4000002
3559.4000012
3655.4417012
3751.8625001
3851.4792013
3951.4792013
4050.0000001
4149.5042001
4239.4000012
4339.0000003
4435.5000011
4534.6542001
4633.5000001
4732.3208001
4830.6958001
4930.5000011
5030.5000001
5130.0000011
5229.7000001
5328.5000011
5427.7208011
5527.4458011
5626.5500001
5726.5500001
5826.5500001
5926.5500011
6026.5500013
6126.5500011
6226.5500001
6326.5500001
6426.0000002
6526.0000002
6626.0000002
6726.0000001
6826.0000001
6925.7000013
7023.0000015
7116.0000011
7214.0000001
7313.5000001
7413.5000001
7513.0000001
7613.0000001
7712.5250001
7812.3500001
7912.3500001
8010.5000001
8110.5000011
8210.5000001
8310.5000001
849.6875001
859.5875011
868.0500001
878.0500001
887.7750001
897.7500001
907.7500001
917.7500001
927.2500001
937.0542001
946.2375001
95[null]01
Out[66]:
Rows: 95 | Columns: 3

See Also

vDataFrame.filter Filters the vDataFrame using the input expressions.