merge_tables
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- merge_tables(input_files: Sequence[str], *, index_cols: Sequence[str] | None = None, separator: str = ',', encoding: str = 'utf-8', join_type: str = 'inner') DataFrame[source]
Merge feature tables horizontally on a shared index column.
This is the library counterpart of
habit merge-csv: multiple CSV or Excel files are joined on subject identifiers without going through CLI argument parsing.- Parameters:
input_files – Paths to CSV or Excel tables (at least two).
index_cols – Index column name(s).
Noneuses each file’s first column; a single name applies to every file; one name per file when the sequence length matchesinput_files.separator – CSV delimiter.
encoding – Text encoding for CSV files.
join_type –
innerorouterpandas join mode.
- Returns:
Merged dataframe indexed by the resolved subject identifier column.
- Raises:
HABITAPIError – When fewer than two readable files are supplied.