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.AnchoredListthat is mergeable, meaning allsecondaryDatasets have a common column that can be used to merge with a column in theprimaryDataset. 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
primaryto merge onsecondary_anchor_col – The column in each
secondaryDataset 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
MergeableAnchoredListfrom an Excel file.get_available_fields()Get all "available" fields in this collection.
get_dataset_history_info()Contruct and return an
macpie.DictLikeTablibDatasetobject containing allmacpie.Dataset.historyinformation.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
MergeableAnchoredListto an Excel file.to_excel_dict()Convert the MergeableAnchoredList to a dictionary.
Attributes
all_fieldsA list of all
macpie.Dataset.all_fieldscontained in thisMergeableAnchoredList.available_fields_sheetnamekey_fieldsA list of all
macpie.Dataset.key_fieldscontained in thisMergeableAnchoredList.merged_dsetThe merged data.
merged_dsetnameName of the merged dataset
primaryThe primary anchor Dataset of the collection.
secondaryThe secondary Datasets of the collection.
selected_fields_sheetnamesys_fieldsA list of all
macpie.Dataset.sys_fieldscontained in thisAnchoredList.tag_anchorTag that gets added to the primary Dataset
tag_mergeableTag that denotes a Dataset can be merged (i.e.
tag_mergedTag that denotes a Dataset has been merged (also means mergeable)
tag_not_mergedTag that denotes a Dataset has not been merged (though mergeable)
tag_secondaryTag that gets added to all the secondary Datasets
to_merge_column_name