macpie.MergeableAnchoredList#
- class macpie.MergeableAnchoredList(primary: Dataset | None = None, secondary: BasicList | None = None, primary_anchor_col=None, secondary_anchor_col=None, selected_fields: DatasetFields | None = None)#
A
macpie.AnchoredList
that is mergeable, meaning allsecondary
Datasets have a common column that can be used to merge with a column in theprimary
Dataset. Includes advanced duplicate handling functionality.- Parameters:
primary – The primary anchor Dataset of the collection.
secondary – The secondary Datasets of the collection.
primary_anchor_col – The column in
primary
to merge onsecondary_anchor_col – The column in each
secondary
Dataset to merge onselected_fields – Fields to keep (discarding the rest)
- __init__(primary: Dataset | None = None, secondary: BasicList | None = None, primary_anchor_col=None, secondary_anchor_col=None, selected_fields: DatasetFields | None = None)#
Methods
__init__
([primary, secondary, ...])add_secondary
(dset)Append dset to
MergeableAnchoredList.secondary
.dataset_display_name_generator
(dset)from_excel_dict
(excel_file, excel_dict)Construct
MergeableAnchoredList
from an Excel file.get_available_fields
()Get all "available" fields in this collection.
get_dataset_history_info
()Contruct and return an
macpie.DictLikeTablibDataset
object containing allmacpie.Dataset.history
information.get_duplicates
()keep_fields
(selected_fields[, ...])Keep specified fields (and drop the rest).
merge
()Perform the merge.
to_excel
(excel_writer[, write_excel_dict, merge])Write
MergeableAnchoredList
to an Excel file.to_excel_dict
()Convert the MergeableAnchoredList to a dictionary.
Attributes
all_fields
A list of all
macpie.Dataset.all_fields
contained in thisMergeableAnchoredList
.available_fields_sheetname
key_fields
A list of all
macpie.Dataset.key_fields
contained in thisMergeableAnchoredList
.merged_dset
The merged data.
merged_dsetname
Name of the merged dataset
primary
The primary anchor Dataset of the collection.
secondary
The secondary Datasets of the collection.
selected_fields_sheetname
sys_fields
A list of all
macpie.Dataset.sys_fields
contained in thisAnchoredList
.tag_anchor
Tag that gets added to the primary Dataset
tag_mergeable
Tag that denotes a Dataset can be merged (i.e.
tag_merged
Tag that denotes a Dataset has been merged (also means mergeable)
tag_not_merged
Tag that denotes a Dataset has not been merged (though mergeable)
tag_secondary
Tag that gets added to all the secondary Datasets
to_merge_column_name