atoti.tables.Tables.infer_data_types()#

Tables.infer_data_types(data, /)#

Infer data types from the passed data.

Parameters:

data (Table | DataFrame | DataLoad) – The data from which data types should be inferred.

Return type:

dict[str, Literal[‘boolean’, ‘boolean[]’, ‘double’, ‘double[]’, ‘float’, ‘float[]’, ‘int’, ‘int[]’, ‘LocalDate’, ‘LocalDateTime’, ‘LocalTime’, ‘long’, ‘long[]’, ‘Object’, ‘Object[]’, ‘String’, ‘String[]’, ‘ZonedDateTime’]]

Example

>>> from datetime import date
>>> dataframe = pd.DataFrame(
...     {
...         "Id": [1, 2, 3],
...         "Name": ["Phone", "Watch", "Laptop"],
...         "Price": [849.99, 249.99, 1499.99],
...         "Date": [
...             date(2024, 11, 27),
...             date(2024, 11, 26),
...             date(2024, 11, 25),
...         ],
...     }
... )
>>> session.tables.infer_data_types(dataframe)
{'Id': 'long', 'Name': 'String', 'Price': 'double', 'Date': 'LocalDate'}

See also

load().