Skip to content

TabularDataUtil

Script for reading and accessing tabular data

read_csv

read_csv(csv_path: str) -> DataFrame

read the data from the csv file

Parameters:

  • csv_path (str) –

    path of the csv file

Returns:

read_xml

read_xml(xml_path: str, *args: list[Any]) -> Optional[DataFrame]

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

Parameters:

  • xml_path (str) –

    xml file path

  • *args (list[Any], default: () ) –

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

Returns:

read_xlsx

read_xlsx(xlsx_path: str, sheet: Union[int, str] = 0) -> DataFrame

read an Excel file

Parameters:

  • xlsx_path (str) –

    excel path

  • sheet (Union[int, str], default: 0 ) –

    sheet index

Returns:

read_matrix

read_matrix(lists: List[List[Any]]) -> DataFrame

read a matrix

Parameters:

  • lists (List[List[Any]]) –

    lists

Returns:

has_duplicates

has_duplicates(
    data_frame: DataFrame, duplicates: List[Union[int, str]]
) -> bool

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

Parameters:

  • data_frame (DataFrame) –

    data frame

  • duplicates (List[Union[int, str]]) –

    duplicates

Returns:

  • bool

    duplicated state

concat

concat(
    data_frames: List[DataFrame], _ignore_index: bool = False, _keys: Any = None
) -> Optional[DataFrame]

concatenate

Parameters:

  • data_frames (List[DataFrame]) –

    data frames

  • _ignore_index (bool, default: False ) –

    ignored index state

  • _keys (Any, default: None ) –

    keys

Returns:

  • Optional[DataFrame]

    concatenated data frame

eval_noex

eval_noex(value: Any, default: Any = None, value_type: Any = None) -> Any

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

Parameters:

  • value (Any) –

    new value

  • default (Any, default: None ) –

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

  • value_type (Any, default: None ) –

    string that indicates the value type

Returns:

  • Any

    eval result

Placeholder