Skip to content

Data Frame

Class full path: TabularDataUtil.DataFrame

Bases: dict

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

Functions

__getitem__(key)

Get items

Parameters:

Name Type Description Default
key Union[int, str, slice, Series]

it can be

required

Returns:

Type Description
Union[DataFrame, Series]

item for the index

__init__(data=None, columns=None, index=None)

Initialization of class DataFrame

Parameters:

Name Type Description Default
data Optional[Dict[Union[int, str], List[str]]]

tabular data which is a dictionary of lists

None
columns Optional[Union[List[int], List[str]]]

column labels

None
index Optional[List[int]]

row index

None

__iter__()

get the data frame iterator

Yields:

Type Description
Iterator

data frame iterator

__len__()

get the length of the data frame

Returns:

Type Description
int

length of the data frame

__repr__()

create a string from the data frame

Returns:

Type Description
str

data frame string

get_row(key, value)

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

Parameters:

Name Type Description Default
key str

column label

required
value str

new value

required

Returns:

Type Description
Optional[Series]

row value

loc(location)

Get a row from data frame

Parameters:

Name Type Description Default
location int

int value of row index, natural row index

required

Returns:

Type Description
Series

Series

short_repr()

Represent the DataFrame by its row size x column size

Returns:

Type Description
str

short data string frame