slitflow.tbl.convert module
- class SortCols(info_path=None)[source]
Bases:
TableChange column depths and sort values.
If you want to change from [“img_no”, “trj_no”, “frm_no”] to [“frm_no”, “img_no”, “trj_no”], set new_depths = [2,3,1].
- Parameters:
- Returns:
Sorted Table
- Return type:
- static process(reqs, param)[source]
Change column depths and sort values.
If you want to change from [“img_no”, “trj_no”, “frm_no”] to [“frm_no”, “img_no”, “trj_no”], set new_depths = [2,3,1].
- Parameters:
reqs[0] (pandas.DataFrame) – Table for sorting.
param["new_depths"] (list of int) – Target depth number of indexes. If list length < total columns, remaining columns are assumed as depth=0.
- Returns:
Sorted table
- Return type:
- class AddColumn(info_path=None)[source]
Bases:
TableAdd a new column with values.
Caution
Do not split the required table.
- Parameters:
- Returns:
Column-added Table
- Return type:
- static process(reqs, param)[source]
Add a new column with values.
- Parameters:
reqs[0] (pandas.DataFrame) – Table to add column.
param["col_values"] (array-like) – Value list of new column.
param["col_name"] (str) – New column name.
- Returns:
Column-added table
- Return type:
- class Obs2Depth(info_path=None)[source]
Bases:
TableMerge tables from different observations into a top level depth.
Caution
This class only works when used in a Pipeline object. Running process method or creating a Data object does not work appropriately.
Observation names for merging should be listed into obs_name argument of
add()in Pipeline class.- Parameters:
- Returns:
Merged Table
- Return type:
- static process(reqs, param)[source]
Merge different Observations into the top level depth.
- Parameters:
reqs (list of pandas.DataFrame) – Tables from different observations.
param["col_name"] (str, optional) – New column name for observation numbers.
- Returns:
Merged table
- Return type: