tabled.multi#
Multi-tabled data structures.
Functions
|
Return all columns from all tables, in order of first appearance. |
|
Return the column names of the first table in |
|
Cast to an iterable of dataframes. |
|
Carries |
|
Run |
|
Interpreter for |
|
Interpreter for |
|
Cast to a mapping of dataframes |
|
Interpreter for |
|
Interpreter for |
|
Set |
Classes
|
A |
|
Command: inner-join the accumulator with the table at |
|
Command: set the accumulator ( |
|
Command: drop |
|
Command: rename accumulator columns per |
- class tabled.multi.ColumnOrientedMapping(tables, columns=<function columns_of_first_table>)[source]#
Bases:
MappingA
{column_name: concatenated_column_values}view over several tables.Keys are column names (by default, the columns of the first table); each value is that column concatenated across all
tables.- array(columns=None)[source]#
Concatenate a single column from all tables into one array.
columnsmust be a single column name (not a list):.df(columns)then has to return a Series (not a DataFrame) for.arrayto work.
- property columns#
The columns that will be used in this mapping (the keys of the mapping)
- columns_of_all_tables()#
Return all columns from all tables, in order of first appearance. This is useful for making a ColumnOrientedMapping without reverting to the default columns argument, which is to use the columns of the first table.
- Return type:
Iterable[Column]
- class tabled.multi.Join(table_key)[source]#
Bases:
objectCommand: inner-join the accumulator with the table at
scope[table_key].
- class tabled.multi.Load(key)[source]#
Bases:
objectCommand: set the accumulator (
scope["cumul"]) toscope[key].
- class tabled.multi.Remove(fields)[source]#
Bases:
objectCommand: drop
fields(column or columns) from the accumulator.
- class tabled.multi.Rename(rename_mapping)[source]#
Bases:
objectCommand: rename accumulator columns per
rename_mapping(old name -> new name).
- tabled.multi.columns_of_all_tables(tables)[source]#
Return all columns from all tables, in order of first appearance. This is useful for making a ColumnOrientedMapping without reverting to the default columns argument, which is to use the columns of the first table.
- Return type:
Iterable[Column]
- tabled.multi.columns_of_first_table(tables)[source]#
Return the column names of the first table in
tables.- Return type:
Iterable[Column]
- tabled.multi.dataframes(tables)[source]#
Cast to an iterable of dataframes.
- Return type:
Iterable[DataFrame]
- tabled.multi.execute_commands(commands, scope, interpreter_map, *, extra_scope=None)[source]#
Carries
commandsoperations out with tables taken fromscope.- Parameters:
commands (
Iterable) – An iterable of join operations to carry out.
- tabled.multi.execute_table_commands(commands, tables, interpreter_map={<class 'tabled.multi.Join'>: <function join_func>, <class 'tabled.multi.Load'>: <function load_func>, <class 'tabled.multi.Remove'>: <function remove_func>, <class 'tabled.multi.Rename'>: <function rename_func>}, *, extra_scope=None)[source]#
Run
commands(Load/Join/Remove/Rename) againsttables; seeexecute_commands.
- tabled.multi.join_func(scope, command)[source]#
Interpreter for
Join: inner-merge the table atcommand.table_keyintoscope["cumul"].If
scope["renamed_columns"]was set by a priorRename, that column renaming is applied to the joined table first, so a later rename stays consistent across joins.- Return type:
- tabled.multi.load_func(scope, command)[source]#
Interpreter for
Load: setscope["cumul"]toscope[command.key].
- tabled.multi.mapping_of_dataframes(tables)[source]#
Cast to a mapping of dataframes
- Return type:
Mapping[KT,DataFrame]
- tabled.multi.remove_func(scope, command)[source]#
Interpreter for
Remove: dropcommand.fieldsfromscope["cumul"].- Return type: