Detect and transform date formats¶
Data Prep detects date formats in a column and lets you transform the cells within the column to ISO date format. Date formatting issues are common problems you'll find with the raw data that you need to prep for your training datasets. Often the values are of type string or numeric and you need to cast them as a date type. For example, you might have a format like 20210101 that you want to tranform into a format like 01/01/2021.
To format date in a column of your dataset:
Locate the column where you want to format dates.
Hover over the column menu icon and click Change into > date.
Click Detect Date Format.
The most common format appears as the custom format.
If a valid format is not detected, an error message displays.
Click Validate First 1000 Rows.
Data Prep validates the data against the specified format and verifies if there are inconsistencies. If validation fails for any cells in a column, an error message specifies which columns failed.
If there are validation errors, perform the date conversion on each invalid date value. Repeat the operation until all values are converted to the specified date format.
Click Save on the top right.
After you save the selection, notice the column type is converted to a date type as indicated by the timer symbol.
You can also detect and validate more than one column.