exception_notes
column_summary_notes(row, columns_to_summarise, match_summaries)
Generate a summary of the columns in the row that match the given values. The function will loop through the groups in match_summaries and check the keys in columns_to_summarise for matches. If a match is found, the note for the column is added to the summary (which is the value of the columns_to_summarise).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row
|
Series
|
The row to summarise |
required |
columns_to_summarise
|
dict
|
The columns to summarise with the note to add to the summary |
required |
match_summaries
|
dict
|
The matches to summarise with the group to add to the summary |
required |
Returns:
Type | Description |
---|---|
Series
|
The summary of the row |
Examples:
>>> row = pd.Series({"col1": "Y", "col2": "N", "col3": "Ceased"})
>>> columns_to_summarise = {col1: "Note 1", col2: "Note 2", col3: "Note 3"}
>>> match_summaries = {"Group 1": "Y", "Group 2": "Ceased"}
>>> column_summary_notes(row, columns_to_summarise, match_summaries)
summary Group 1: Note 1. Group 2: Note 3.
Source code in devices_rap/exception_notes.py
create_exception_notes(exceptions, drop_columns=True)
Function to create a summary of the exception columns in the exceptions DataFrame. The function
is a wrapper apply function that calls the column_summary_notes function to generate the
exception_notes
column, where the columns_to_summarise
is defined as:
{
"exception_status_legacy_list": "Legacy List",
"exception_status_planned_migration": "Planned Migration",
"exception_status_category_list": "Category List",
"exception_status_product_list": "Product List",
"exception_status_hcted_category": "Hcted Category",
"exception_status_stock_<180_days": "Stock <180 Days",
}
match_summaries
is defined as:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exceptions
|
DataFrame
|
The exceptions DataFrame to create the exception notes for |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
The exceptions DataFrame with the |