Sell with Insights
Utilize resolved restaurant records to support marketing campaigns with insights.
We'll cover the following...
We'll cover the following...
This lesson is about how to put resolved data into action to improve decision-making. The restaurants data contains customer records with hidden duplicates. The cross_ref table encodes our resolution. It is time to use the resolved data and address the needs of the business.
Our cross_ref table covers only those original customer IDs with at least one match. We parse the values to strings and expand that table to cover all restaurants for joining with transactional data.
Python 3.8
restaurants = pd.read_csv('solvers_kitchen/restaurants.csv')cross_ref['resolved_customer_id'] = 'cluster_' + cross_ref['resolved_customer_id'].astype(str)cross_ref = restaurants[['customer_id']].merge(cross_ref, on='customer_id', how='left')cross_ref.loc[cross_ref['resolved_customer_id'].isnull(), 'resolved_customer_id'] = cross_ref['customer_id']print(cross_ref.sample(5, random_state=1))
Now, we add the resolved ID to every table having the original customer ID.
Python 3.8
restaurants = restaurants.merge(cross_ref, on='customer_id', how='left')projects = projects.merge(cross_ref, on='customer_id', how='left')contracts = contracts.merge(cross_ref, on='customer_id', how='left')order_headers = order_headers.merge(cross_ref, on='customer_id', how='left')print(restaurants.sample(2, random_state=1).T)
We are ready to utilize the resolved data to support the business with insights.