--- title: "system.dataset.filterColumns" description: "Takes a dataset and returns a view of the dataset containing only the columns found within the given list of columns." --- # system.dataset.filterColumns > Takes a dataset and returns a view of the dataset containing only the columns found within the given list of columns. This function is used in **Python Scripting**. ## Description Takes a [dataset](platform/scripting/python-scripting/variables-datatypes-and-objects/datasets.md) and returns a view of the dataset containing only the columns found within the given list of columns. :::note Datasets are immutable, which means they cannot be directly modified once created. Instead, this scripting function returns a new dataset with some modification applied, which must be assigned to a variable to be used. See [Altering a Dataset](platform/scripting/python-scripting/variables-datatypes-and-objects/datasets.md#altering-a-dataset). ::: ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.dataset.filterColumns(dataset, columns)` ### Parameters Type | Parameter | Description ------- | ------- | ------- Dataset / PyDataset | `dataset` | The starting dataset. List[Integer] / List[String] | `columns` | A list of columns to keep in the returned dataset. The columns may be in integer index form (starting at 0), or the name of the columns as strings. If a value passed to this parameter is not in a list, then an empty dataset will be returned. ### Returns **Dataset** - A new dataset containing the filtered columns. The order of columns in this dataset is determined by the column order provided to the columns parameter. ### Scope Gateway, Vision Client, Perspective Session ## Code Examples ```python title="Code Snippet" # This example takes the dataset from a two column Bar Chart and displays a subset of the data in two separate tables. # This is performed in a button component actionPerformed script. chartData = event.source.parent.getComponent('Bar Chart').data north = [0, 1] # Label and North Area columns (using column index) south = ["Label", "South Area"] # Label and South Area columns (using column names) filteredData = system.dataset.filterColumns(chartData, north) event.source.parent.getComponent('NorthTable').data = filteredData filteredData = system.dataset.filterColumns(chartData, south) event.source.parent.getComponent('SouthTable').data = filteredData ```