--- title: "system.dataset.toDataset" description: "This function is used to convert PyDatasets to datasets and create new datasets from raw Python lists. When creating a new dataset, headers should have unique names." --- # system.dataset.toDataset > This function is used to convert PyDatasets to datasets and create new datasets from raw Python lists. When creating a new dataset, headers should have unique names. This function is used in **Python Scripting**. ## Description This function is used to create new datasets from raw Python lists. When creating a new dataset, headers should have unique names. For more information on datasets and PyDatasets, see the [Datasets](platform/scripting/python-scripting/variables-datatypes-and-objects/datasets.md) page. ## 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.toDataset(headers, data)` ### Parameters Type | Parameter | Description ------- | ------- | ------- List[String] | `headers` | The column names for the dataset to create. List[Any] | `data` | A list of rows for the new dataset. Each row must have the same length as the headers list, and each value in a column must be the same type. ### Returns **Dataset** - The newly created dataset. ### Scope Gateway, Vision Client, Perspective Session ## Code Examples ```python title="Code Snippet - Create a simple dataset" # This example create a single column dataset. header = ['myColumn'] rows = [[1], [2]] dataset = system.dataset.toDataset(header, rows) ```