Struct TableInfo

struct TableInfo

A wrapper class around a data table, which in practice a cudf dataframe. It gives the flexibility to perform operations on a data table

Public Functions

TableInfo() = default
TableInfo(std::shared_ptr<const IDataTable> parent, cudf::table_view view, std::vector<std::string> index_names, std::vector<std::string> column_names)
const pybind11::object &get_parent_table() const

Get reference of underlying cuDF DataFrame as a python object.

Returns

pybind11::object

const cudf::table_view &get_view() const

Get reference of a cudf table view.

Returns

cudf::table_view

std::vector<std::string> get_index_names() const

Get index names of a data table.

Returns

std::vector<std::string>

std::vector<std::string> get_column_names() const

Get column names of a data table.

Returns

std::vector<std::string>

cudf::size_type num_indices() const

Get size of a index names in a data table.

Returns

cudf::size_type

cudf::size_type num_columns() const

Get columns count in a data table.

Returns

cudf::size_type

cudf::size_type num_rows() const

Get rows count in a data table.

Returns

cudf::size_type

pybind11::object __attribute__((visibility("default"))) as_py_object() const

Returns the underlying cuDF DataFrame as a python object.

Note: The attribute is needed here as pybind11 requires setting symbol visibility to hidden by default

void insert_columns(const std::vector<std::string> &column_names, const std::vector<TypeId> &column_types)

Insert new columns to a data table with the value zero for each row.

Parameters
  • column_names – : Names of the columns to be added to a table

  • column_types – : Column data types

void insert_missing_columns(const std::vector<std::string> &column_names, const std::vector<TypeId> &column_types)

Insert missing columns to a data table with the value zero for each row.

Parameters
  • column_names – : Names of the columns to be added to a table

  • column_types – : Column data types

const cudf::column_view &get_column(cudf::size_type idx) const

Returns a reference to the view of the specified column.

Throws

std::out_of_range – If column_index is out of the range [0, num_columns)

Parameters

idx – : The index of the desired column

Returns

cudf::column_view : A reference to the desired column

TableInfo get_slice(cudf::size_type start, cudf::size_type stop, std::vector<std::string> column_names = {}) const

Get slice of a data table info based on the start and stop offset address.

Parameters
  • start – : Start offset address

  • stop – : Stop offset address

  • column_names – : Columns of interest

Returns

TableInfo

© Copyright 2023, NVIDIA. Last updated on Feb 3, 2023.