.. _`Select rows in Tables`: .. _`org.sysess.sympathy.data.table.selecttablerowss`: Select rows in Tables ~~~~~~~~~~~~~~~~~~~~~ .. image:: select_table_rows.svg :width: 48 Reduction of rows in Table according to specified filter. Documentation ############# Select rows in Tables by applying a constraint to a number of columns in the incoming Table. The output Table has the selected rows from incoming Table with order preserved. The number of rows in the output is therefore always less than or equal to the number of rows in the input. The number of columns is the same. Constraint ========== The constraint can be defined by selecting a comparison operator in the drop down menu and a entering a constraint value in the text field, the constraint value will be read as a value of the same type as the column it is compared to. For information about how to enter text, see :ref:`appendix_typed_text`. Alternatively a custom filter function can be used. Reduction ========= The constraint will be applied for each selected column. The results per column are then combined using the selected reduction method. If set to 'all' (the default) the constraint needs to be True in all selected column for a row to be included in the output. If set to 'any' it is enough that the constraint is True for any single selected column. When only one column is selected this option has no effect. Masked values ============= Rows where any of the selected columns are masked are considered to fail the constraint check. In other words they are never included in the output. Custom filter functions can override this behavior. Custom filter ============= A custom filter function can be defined by writing a lambda function. The lambda function will be called once for each selected column with that column as a numpy array as argument. The lambda function should return an array-like object (e.g. `numpy.ndarray` or `pandas.Series`) with boolean dtype and as many items as there was in the argument. See https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions for a description of lambda functions. Have a look at the :ref:`Data type APIs` to see what methods and attributes are available on the data type that you are working with. If the custom filter returns a masked array, masked values are treated as False (i.e. such rows are not included in the output). Definition ########## *Input ports*: :Input: [table] Input *Output ports*: :Output: [table] Output *Configuration*: **Columns to filter** (columns) Select columns for comparison relation **Constraint must be satisfied in** (exist) Constraint must be satisfied in: Any selected column or All selected columns. **Relation** (relation) Select comparison operator for relation **Filter constraint** (constraint) Specify constraint value for comparison relation **Use compatible string constraints (deprecated)** (constraint_compat) Enable string constraint quote compatibility with older Sympathy versions. Will be removed in 1.7.0. **Use custom filter** (use_custom_predicate) Select to use custom filter **Custom filter** (predicate) Write a custom filter as a Python lambda function **Preview rows** (limit) Rows to display .. automodule:: node_select_table_rows .. class:: SelectTablesRows Related nodes ############# * :ref:`org.sysess.sympathy.data.table.selecttablerows` * :ref:`org.sysess.sympathy.data.table.selectadafrows` * :ref:`org.sysess.sympathy.data.table.selecttablerowsfromtable` * :ref:`org.sysess.sympathy.slice.slicedatatable` * :ref:`org.sysess.sympathy.filters.columnfilternode`