to_table
The to_table
method creates a new table from a pandas.DataFrame
.
Syntax
to_table(df: pandas.DataFrame, cols: list[str] = None) -> Table
Parameters
Parameter | Type | Description |
---|---|---|
df | pandas.DataFrame | The |
cols optional | list[str] | The columns to convert. If not specified, all columns are converted. |
Returns
A Deephaven Table.
Example
The following example uses pandas to create a DataFrame, then converts it to a Deephaven Table with to_table
.
from deephaven.pandas import to_table
import pandas as pd
d = {"col1": [1, 2], "col2": [3, 4]}
df = pd.DataFrame(data=d)
result = to_table(df)
- result
- df