The Convert Column Types Tab

The Convert Column Types tab allows you to convert column data types.

Basic Usage

Opening the Type Conversion Tab

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

Configuring Conversion

  1. Select the target data type in the To column dropdown
  2. Check the values that cannot be converted in the Result column
  3. Select error handling in On Error
  4. Click Preview to review the conversion result
  5. Click Apply to execute the conversion

Type conversion settings

The Result column shows, for each column, the values that cannot be converted when all rows of the dataset are converted. It shows the number of values that cannot be converted and up to three of those values, in descending order of row count. When there are four or more distinct values, it also shows how many distinct values are not listed. Missing values (NULL and, in string columns, values that are empty after removing surrounding whitespace) are not counted as values that cannot be converted. Columns whose type does not change show No change.

In the next example, the bill_length_mm column is being converted from string to float64. The Result column shows that the string NA appears in 2 rows and that those 2 values become NULL.

To of bill_length_mm set to float64

When a column set to Exclude row excludes rows, MIDAS shows the number of excluded rows above the table. A row that cannot be converted in several columns counts as one row.

Auto-detecting Types

Click Auto-detect types to have MIDAS examine the values in each string column and set To to the proposed type for each column that gets a proposal. Review the proposals, adjust them if needed, and continue to Preview. Columns that are not string are left unchanged.

Types proposed by Auto-detect

MIDAS detects the type of a column by the same rules as CSV import, and proposes the type only for columns whose detected type is other than string. MIDAS leaves To unchanged for columns without a proposal and lists those columns above the table. MIDAS treats strings like NA as values, not as missing values, so it proposes no type for columns containing NA. To convert such columns, select the type manually and choose how to handle unconvertible values in On Error.

Convertible Values

Except for the following 3 points, the values that can be converted from a string to types other than enum are the same as the values that can be interpreted as that type in CSV Type Detection. When converting an Enum column to int64, float64, boolean, date, or datetime, MIDAS also takes the values in the Enum definition as strings and interprets them by the same rules. The 3 points that differ from type detection are as follows.

  • A column of only 0 and 1 can also be converted to boolean. Type detection makes this column int64
  • Conversion to float64 does not treat an integer whose absolute value exceeds 2^53 as unconvertible, and rounds it to the nearest float64 value
  • Conversion to date does not treat a value with a time, such as 2024-01-15 10:30:00, as unconvertible, and drops the time to give the date of that day. A value with a time zone offset such as Z or +09:00 cannot be converted to date

Only conversions with a number notation can interpret values written in notations other than these rules. The timezone for datetime conversion only changes which time zone a value without a time zone offset is taken to be in.

For conversion to every type, MIDAS strips leading and trailing whitespace from a value of a string column before interpreting it. A value that becomes empty after stripping becomes a missing value (NULL), not an unconvertible value.

Converting to Enum Type

To convert a column to an Enum type, create an Enum definition in The Manage Enums Tab, and select that Enum definition in To in the steps of Configuring Conversion.

Only string, int64, and Enum columns can be converted directly to an Enum type; for columns of other types, To does not list Enum definitions. For a float64, boolean, date, or datetime column, first convert it to string, and then convert the column of the resulting dataset to the Enum type. MIDAS converts values of these types to strings in its own format; for example, the float64 value 2 becomes 2.0.

MIDAS shows values not included in the definition as unconvertible values in the Result column. For an int64 column, MIDAS converts each value to a string in decimal notation before matching. Therefore, the value 308 corresponds to the definition value 308, and does not correspond to the definition value 0308.

To use the order of the values you arranged in the Manage Enums tab for statistics such as the median and for greater-than and less-than comparisons in filter expressions, change the column to the ordinal scale with Edit Scale of Measurement in Data Table after the conversion.

Error Handling (On Error)

Choose how to handle values that cannot be converted:

OptionDescription
NULLReplace unconvertible values with NULL (missing)
Exclude rowRemove rows containing unconvertible values from the dataset
FailStop processing and show an error if any value cannot be converted

Example: String to Integer Conversion

For conversion to integer (int64), decimals like "1.5", number-like strings with leading zeros like "007", and integers beyond ±2^53 also count as unconvertible, in addition to non-numeric values like "abc".

Timezone for Datetime Conversion

When you select datetime in To for a string column, a timezone field (Timezone for values without a UTC offset) appears below the row. Typing part of a name filters the candidates (e.g., tokyo finds Asia/Tokyo). This field sets the timezone in which values without a timezone offset are interpreted. The default is UTC: a value like 2025-01-15 14:30:00 is interpreted as 14:30 UTC. With Asia/Tokyo, the same value is interpreted as 14:30 Japan Standard Time and stored as 05:30 UTC. Use this setting when a CSV recorded in local time cannot be re-exported in a format with offsets.

Timezone field for a string to datetime conversion

The Timezone setting applies only to values without an offset. A value with an offset, such as 2025-01-15T14:30:00+09:00, is interpreted with its own offset regardless of the setting. When a column mixes both kinds of values, this rule applies per value. A date-only value is interpreted as 00:00:00 in the specified timezone.1

The specified timezone is stored in the conversion settings as a fixed value. Opening the project on a device with a different browser timezone and recomputing does not change the result. See CSV Type Detection for how datetime values are stored and displayed.

Number Notation

When you select int64 or float64 in To for a string column, a notation field (Number notation) appears below the row. This field sets which characters the values use as the thousands separator and the decimal mark, chosen from notation examples such as 1,234.5 and 1.234,5. The float64 default 1234.5 is the notation without a thousands separator and with . as the decimal mark. Because int64 does not convert decimals, its choices show only the thousands separator, such as 1,234 and 1.234. A column exported to CSV from a spreadsheet with a thousands-separator display format has values like 12,340, which the default notation cannot convert. With the int64 choice 1,234 selected for this column, MIDAS converts 12,340 to 12340. The thousands separator can be a comma, a period, a space, or an apostrophe.2 This setting is the notation for reading text, and it is separate from the display format of numbers that Number Format... sets in the Data Table.

Number notation field for a string to int64 conversion

MIDAS does not guess the notation from the values. The value 1,234 stands for 1234 in a notation that uses a comma as the thousands separator and for 1.234 in a notation that uses a comma as the decimal mark, and the value alone does not tell which. For this reason, type auto-detection proposes a numeric type only for columns that the default notation can read, and resets Number notation to the default for the columns it proposes a type for.

A value with one separator followed by exactly three digits converts with either notation, to different numbers. 1,234 becomes 1234 with the 1,234.5 notation and 1.234 with the 1.234,5 notation. If every value in a column has this form, the Result column shows no values that cannot be converted even when the notation is chosen by mistake. Choose the notation from the settings of the software that exported the data, or from the values in other rows.

A thousands separator appears either at every position between groups of three digits of the integer part, or nowhere. With the 1,234.5 notation, 1,5, 12,34, and 1234,567 cannot be converted. In a column that has values other than one separator followed by three digits, a notation chosen by mistake therefore appears in the Result column as values that cannot be converted. Values without a thousands separator (999 and 1234.5 for float64) are also converted when their decimal mark matches the notation. The fractional part and the exponent cannot contain a thousands separator.

The selected notation is stored in the conversion settings. When you open the conversion with Editing a Saved Conversion, the stored notation is selected.

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.

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.

Editing a Saved Conversion

Existing converted datasets can be edited. Right-click the dataset in the Project Lineage tab, or select Edit Operation... from the dataset's menu button (⋮) in Project Overview, and Convert Column Types opens in edit mode with the source dataset and conversion settings restored.

Changing the source dataset resets the conversion settings, so configure them again for the new source columns. Click Apply and confirm, and the same dataset is recomputed with the new settings. The dataset name does not change. Derived datasets that depend on this dataset are recomputed the next time their data is needed, and dependent models are re-estimated automatically.

If the transformation is changed from another path such as another edit tab or the Agent API between the time this tab opens and the time you click Apply, MIDAS stops the save and shows a dialog. Choose Overwrite with This Tab's Edits to save the edits in this tab over the version changed elsewhere. Choose Keep Editing to return to the edit tab without saving; the edits stay in place.

See also

Footnotes

  1. A time that does not exist due to a daylight saving transition and a time that occurs twice are both interpreted with the standard time offset. For example, in America/New_York, the nonexistent time 2025-03-09 02:30:00 becomes 07:30 UTC, and the repeated time 2025-11-02 01:30:00 becomes 06:30 UTC. ↩

  2. The space separator matches the ordinary space (U+0020) as well as the no-break space (U+00A0) and the narrow no-break space (U+202F). The apostrophe separator matches U+0027 as well as the right single quotation mark (U+2019). ↩