---
title: Column Type Conversion
description: Convert column data types (string to number, date format changes) with configurable error handling: replace with NULL, exclude rows, or fail. Preview results before applying changes.
priority: 0.6
---

# Column Type Conversion {#column-type-conversion}

The Convert Column Types tab allows you to convert column data types. Use this when converting strings to numbers or changing date formats.

## Basic Usage {#basic-usage}

### Opening the Type Conversion Tab {#opening-the-type-conversion-tab}

1. Open the Data Table tab
2. Right-click a column header
3. Select **Convert Column Types...**

### Configuring Conversion {#configuring-conversion}

1. Select the target data type in the **To** column dropdown
2. Select error handling in **On Error**
3. Click **Preview** to review the conversion result
4. Click **Apply** to execute the conversion

![Type conversion settings](../shared/images/column-type-conversion-settings.webp)

In this example, the `bill_length_mm` column is being converted from `string` to `float64`. The preview table on the right shows the conversion results.

![Selecting columns to convert](../shared/images/column-type-conversion-configured.webp)

## Data Types {#data-types}

The data types available in MIDAS are:

| Data Type        | Description                                                       | Examples                |
|------------------|-------------------------------------------------------------------|-------------------------|
| `boolean`        | Boolean value                                                     | `true`, `false`         |
| `int64`          | Integer                                                           | `42`, `-100`            |
| `float64`        | Decimal                                                           | `3.14`, `-0.5`          |
| `date`           | Date                                                              | `2024-01-15`            |
| `datetime`       | Date and time                                                     | `2024-01-15 10:30:00`   |
| `string`         | Text                                                              | `"Hello"`, `"Tokyo"`    |
| `<Enum name>`    | Project-defined category set (created via [Enum Definitions](enum-definitions)) | `species_enum`, etc.    |

Enum types created via [Enum Definitions](enum-definitions) appear in the **To** dropdown by name (e.g., `species_enum`). See [Enum Definitions](enum-definitions#converting-string-columns-to-enum-type) for instructions on converting string columns to Enum type.

## Error Handling (On Error) {#error-handling-on-error}

Choose how to handle values that cannot be converted:

| Option          | Description                                          |
|-----------------|------------------------------------------------------|
| **NULL**        | Replace unconvertible values with NULL (missing)     |
| **Exclude row** | Remove rows containing unconvertible values from the dataset |
| **Fail**        | Stop processing and show an error if any value cannot be converted |

### Example: String to Integer Conversion {#example-string-to-integer-conversion}

If the original data contains values like `"abc"` that cannot be converted to numbers:

- **NULL**: `"abc"` becomes `NULL` (missing value)
- **Exclude row**: The entire row is removed from the dataset
- **Fail**: Conversion is aborted and an error message is displayed

## Preview Feature {#preview-feature}

Click the **Preview** button to review conversion results before applying. The preview screen displays the converted data, and in Exclude row mode, rows with conversion errors are highlighted. If everything looks correct, click **Apply** to execute. If there are issues, click **Back** to return to settings and make adjustments.

## Executing Conversion {#executing-conversion}

When you click **Apply**, a dialog appears to enter a new dataset name. Enter a name and click **OK** to create the conversion result as a new dataset.

The original dataset is not modified. Conversion results are always saved as a new Derived Dataset.

## See also {#see-also}

- **[Data Table](data-table)** - Viewing and manipulating data
- **[Data Preparation and Import](data-preparation)** - About data types and measurement scales
- **[Data Processing with SQL Editor](sql-editor)** - Advanced data transformation with SQL
