frameon.find_inconsistent_mappings#

find_inconsistent_mappings(df: DataFrame, key_column: str, value_column: str, return_summary: bool = False, verbose: bool = True, sample_size: int = 3) DataFrame | Dict[str, Any][source]#

Identifies rows where keys map to inconsistent value. Useful for detecting data integrity issues and many-to-many relationships.

Parameters:#

dfpd.DataFrame

Input DataFrame to analyze

key_columnstr

Column containing keys to check for consistency

value_columnstr

Column containing values that should be consistently mapped

return_summarybool, optional

Whether to return summary statistics or inconsistent rows

verbosebool, optional

Whether to print a formatted summary of the results

sample_sizeint, optional

Number of sample inconsistencies to display when verbose=True

Returns:#

pd.DataFrame or dict
If return_summary=False:

DataFrame containing all rows with inconsistent mappings

Else:

Dictionary with summary statistics of inconsistencies