Filter data with Code Assist

For this tutorial we’ll use the Titanic data.

Quick Filter

  1. The Titanic data have been assigned to a variable named df.

  2. Hover over the assistant icon icon. Select the Transformations item from the popup menu.

    Select the transformations item
  3. The Transformations dialog appears. Select the target variable from the dropdown menu and preview the data.

  4. Click on the kebab icon to the right of any of the nan values in the Cabin column. Then click on the Filter values like this popup button.

    Click the kebab then select Filter values like this
  5. A dialog appears with fields to choose a column, an operator and a value. The value is set to nan by default.

  6. Since we are wanting to exclude records with missing values, we change the operator from == to !=. Press the Apply button.

    Configure the filter
  7. The required code is inserted into the notebook and immediately executed.

Output from inserted and executed code

Manual Filter

  1. Under the Column selector choose Embarked. Set Operator to == and Value to S. Turn the as string toggle on. Press the Add Transformation button.

    Configure the transformation
  2. The preview is updated to show only those records where Embarked is "S".

  3. Under the Column selector choose Pclass. Set Operator to < and Value to 3. Press the Add Transformation button.

  4. The preview is updated to show only those records where Embarked is "S" and Pclass is less than 3. Press the Insert Code button.

  5. The required code is inserted into the notebook and immediately executed.

Output from inserted and executed code