Leetcode Problem 1693. Daily Leads and Partners

1693. Daily Leads and Partners

Leetcode Solutions

Group by and Aggregation to Find Unique Leads and Partners

Algorithm

  1. Group the data by date_id and make_name.
  2. For each group, count the number of distinct lead_id values. This gives us the count of unique leads.
  3. For each group, count the number of distinct partner_id values. This gives us the count of unique partners.
  4. Rename the aggregated columns to unique_leads and unique_partners.
  5. Return the resulting DataFrame with the new column names.

erDiagram
    DailySales {
        date date_id
        varchar make_name
        int lead_id
        int partner_id
    }

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...