Skip to content

DataFrame

Canonical path: Utils.TabularDataUtil.DataFrame

Bases: dict

Two-dimensional tabular data structure with labeled axes (rows and columns)

Methods:

  • __getitem__

    Get items

  • __init__

    Initialization of class DataFrame

  • __iter__

    get the data frame iterator

  • __len__

    get the length of the data frame

  • __repr__

    create a string from the data frame

  • get_row

    Get a row from data frame by a condition: column_label == value

  • loc

    Get a row from data frame

  • short_repr

    Represent the DataFrame by its row size x column size

__getitem__

__getitem__(key: Union[int, str, slice, Series]) -> Union[DataFrame, Series]

Get items

Parameters:

  • key (Union[int, str, slice, Series]) –

    it can be

Returns:

__init__

__init__(
    data: Optional[Dict[Union[int, str], List[str]]] = None,
    columns: Optional[Union[List[int], List[str]]] = None,
    index: Optional[List[int]] = None,
)

Initialization of class DataFrame

Parameters:

  • data (Optional[Dict[Union[int, str], List[str]]], default: None ) –

    tabular data which is a dictionary of lists

  • columns (Optional[Union[List[int], List[str]]], default: None ) –

    column labels

  • index (Optional[List[int]], default: None ) –

    row index

__iter__

__iter__() -> Iterator

get the data frame iterator

Yields:

  • Iterator

    data frame iterator

__len__

__len__() -> int

get the length of the data frame

Returns:

  • int

    length of the data frame

__repr__

__repr__() -> str

create a string from the data frame

Returns:

  • str

    data frame string

get_row

get_row(key: str, value: str) -> Optional[Series]

Get a row from data frame by a condition: column_label == value

Parameters:

  • key (str) –

    column label

  • value (str) –

    new value

Returns:

  • Optional[Series]

    row value

loc

loc(location: int) -> Series

Get a row from data frame

Parameters:

  • location (int) –

    int value of row index, natural row index

Returns:

short_repr

short_repr() -> str

Represent the DataFrame by its row size x column size

Returns:

  • str

    short data string frame