How the type is inferred
The rules are applied in this order.- A column with no values at all is
ignore. - A boolean column is a
category. - A datetime column is a
date. A string column is also adatewhen at least 95% of its distinct values read as dates. - A column whose cells are lists of numbers of the same length is an
embedding. - A numeric column is a
number. It is anidinstead when it has at least 50 rows, holds only whole numbers, nearly every value is different (99% or more), and its name looks like an id, such asid,customer_idoraccount_no. - A string column is
textwhen it has at least 64 distinct values and at least half of its values contain a space. - A string column is an
idwhen it has at least 50 rows, nearly every value is different, and hardly any value contains a space. - Any other string column is a
category.
image, audio and document types are never inferred, because a link looks like any other string. Set them yourself with column_types.
The report of every request lists each column with its type and the reason the rule gave. Check it the first time you send a new table.
Overriding a type
Passcolumn_types to change the type of any column.
- A code stored as a number, such as a postcode or a product code, is a
category, not anumber. - A short free-text field with few distinct values may be read as a
category. Mark it astextif the wording matters. - A column that would leak the answer, such as a field filled in after the outcome, should be
ignore.
Dates
A date is read as a point in time. When you give atime_column, every other date column is read relative to the row’s own time. For example, an account_opened date on a row dated 31 October tells the model how long the account had been open on 31 October. This keeps the meaning of the column stable as time moves on.