A unique identifier is a value used to distinguish one entity or record from others in a dataset. It supports combining records, tracing their source, and checking whether repeated rows represent the same entity or merely separate records with similar details. section 3.3.1 section 3.4.3
Do not treat differing identifiers as proof that two records are different customers. When otherwise identical records have different IDs, removing one casually can discard a valid source record; retain the IDs and establish links between records that may describe the same underlying entity. section 3.3.1 section 3.4.3
Use identifiers as part of a practical data-quality workflow:
- Inspect identifier ranges, missing values, and whether associated fields such as categories or brands stay consistent for each ID. section 3.4.3 section 4.4.1
- Assign an identifier to records that lack one when later matching depends on linking records to an entity. section 3.4.3
- Keep a separate relationship to other possible IDs when duplicate detection indicates that multiple records may belong to one entity. section 3.4.3
- Validate that each product ID maps to one intended set of descriptive attributes before using those attributes in analysis. section 4.4.1
Giving guest customers identifiers
Guest checkout records without customer IDs cannot be linked to related accounts through an identifier. One workable convention assigns each unique guest combination a negative integer ID, leaving the existing positive customer-ID range untouched. The chosen convention is artificial but makes every guest record addressable for later deduplication. section 3.4.3
all_guests = all_customers[all_customers["is_guest"]].copy() new_ids = np.arange(-1, -(len(all_guests) + 1), -1) #1 all_customers.loc[all_customers["is_guest"], "customer_id"] = new_ids
Generates sequential negative customer IDs and assigns them only to rows marked as guest accounts. section 3.4.3








