Skip to content

Functions of the module Tabular Data Util

Module full path: Utils.TabularDataUtil

Script for reading and accessing tabular data

read_csv(csv_path)

read the data from the csv file

Parameters:

Name Type Description Default
csv_path str

path of the csv file

required

Returns:

Type Description
DataFrame

data frame

read_xml(xml_path, *args)

Read partial data from xml file and return a DataFrame. Xml file should be those which can be converted into tabular data.

Parameters:

Name Type Description Default
xml_path str

xml file path

required
*args

string, the ElementTree tags, which serve later as column labels of data frame

()

Returns:

Type Description
Optional[DataFrame]

data frame

read_xlsx(xlsx_path, sheet=0)

read an Excel file

Parameters:

Name Type Description Default
xlsx_path str

excel path

required
sheet Union[int, str]

sheet index

0

Returns:

Type Description
DataFrame

data frame

read_matrix(lists)

read a matrix

Parameters:

Name Type Description Default
lists List[List[Any]]

lists

required

Returns:

Type Description
DataFrame

matrix

has_duplicates(data_frame, duplicates)

check if data frame has duplicated column headers and return them if it has

Parameters:

Name Type Description Default
data_frame DataFrame

data frame

required
duplicates List[Union[int, str]]

duplicates

required

Returns:

Type Description
bool

duplicated state

concat(data_frames, _ignore_index=False, _keys=None)

concatenate

Parameters:

Name Type Description Default
data_frames List[DataFrame]

data frames

required
_ignore_index bool

ignored index state

False
_keys Any

keys

None

Returns:

Type Description
Optional[DataFrame]

concatenated data frame

eval_noex(value, default=None, value_type=None)

Evaluate value from Table without throwing exceptions, only used to evaluate value that is string or None

Parameters:

Name Type Description Default
value Any

new value

required
default Any

has a higher priority than value_type, when both default and value_type are given

None
value_type Any

string that indicates the value type

None

Returns:

Type Description
Any

eval result