Table object#

class legate_dataframe.lib.core.table.LogicalTable(columns: Iterable[LogicalColumn], column_names: Iterable[str])#

Collection of logical columns

The order of the collection of columns is preserved. Use .get_column and .get_columns to access individual columns.

Unlike libcudf, the columns in a LogicalTable have names, which makes it possible to retrieve columns by name using .get_column(). Additionally, when reading and writing tables to/from files, the column names are read and written automatically.

Notice, the table doesn’t own the columns, a column can be in multiple tables.

static from_cudf(df: cudf.DataFrame) LogicalTable#

Create a logical table from a local cudf dataframe

This call blocks the client’s control flow and scatter the data to all legate nodes.

Parameters:

df (cudf.DataFrame) – cudf dataframe

Return type:

New logical table

get_column(self, column: int | str) LogicalColumn#

Returns a reference to the specified column

Parameters:

column (int or str) – Index or name of the desired column

Return type:

The desired column

Raises:
  • IndexError – If column doesn’t exist

  • TypeError – If column isn’t a string or integer

  • OverflowError – If column is a negative integer

get_column_names(self) List[str]#

Returns a list of the column names order by column indices

Returns:

A list of the column names

Return type:

list of str

num_columns(self) int#

Returns the number of columns

Return type:

The number of columns

num_rows(self) int#

Returns the number of rows

Returns:

The number of rows

Return type:

int

Raises:

RuntimeError – if table is unbound

repr(self, size_t max_num_items=30) str#

Return a printable representational string

Parameters:

max_num_items (int) – Maximum number of items to include before items are abbreviated.

Return type:

Printable representational string

to_cudf(self) cudf.DataFrame#

Copy the logical table into a local cudf table

This call blocks the client’s control flow and fetches the data for the whole table to the current node.

Returns:

A local cudf dataframe copy.

Return type:

cudf.DataFrame