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"} |
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"})
Out[66]:
See Also¶
| vDataFrame.filter | Filters the vDataFrame using the input expressions. |
