maxframe.liteframe.LiteFrame.from_tensor#

static LiteFrame.from_tensor(tensor: Tensor, columns: str | List | Index = None, gpu: bool = None)#

Create a LiteFrame from a MaxFrame tensor.

The tensor may be 1-d or 2-d:

  • 1-d tensor -> a single-column LiteFrame. The column is named columns[0] when columns is list-like, or columns when it is a string. When columns is not given, "0" is used.

  • 2-d tensor (m x n) -> an n-column LiteFrame named by columns. When columns is not given, ["0", "1", ..., str(n - 1)] is used.

Column names are normalized to lowercase to stay consistent with the case-insensitive storage convention used across LiteFrame.

Parameters:
  • tensor (Tensor) – 1-d or 2-d MaxFrame tensor.

  • columns (str, list or pandas.Index, optional) – Column name(s) for the resulting LiteFrame.

  • gpu (bool, optional) – Whether the result runs on GPU. Inferred from the tensor when omitted.

Returns:

A lazy LiteFrame backed by the given tensor.

Return type:

LiteFrame

See also

LiteFrame.to_tensor

Convert the LiteFrame to a MaxFrame tensor.

LiteFrame

Construct a LiteFrame from dict, DataFrame, or tensor.