to_table

The to_table method creates a new table from a pandas.DataFrame.

Syntax

Parameters

ParameterTypeDescription
dfpandas.DataFrame

The pandas.DataFrame instance.

cols optionallist[str]

The columns to convert. If not specified, all columns are converted.

infer_objects optionalbool

Whether to infer the best possible types for columns of the generic Object type in the DataFrame before creating the table. When True, Pandas convert_dtypes() method is called before creating the table. Any conversion will make a copy of the data. The default value is True.

Returns

A Deephaven Table.

Examples

The following example uses pandas to create a DataFrame, then converts it to a Deephaven Table with to_table.

The following example uses the cols parameter to convert only the specified columns.

The following example creates a DataFrame with a generic Object type column. It then converts it to a table twice: once with infer_objects=True and once with infer_objects=False. The metadata for each resulting table is shown to demonstrate the difference in column types.