Skip to content

Completed Pandas10#17

Open
DhruvParashar246 wants to merge 1 commit intosuper30admin:mainfrom
DhruvParashar246:main
Open

Completed Pandas10#17
DhruvParashar246 wants to merge 1 commit intosuper30admin:mainfrom
DhruvParashar246:main

Conversation

@DhruvParashar246
Copy link

No description provided.

@super30admin
Copy link
Owner

The student has provided solutions to three different pandas problems. Here's an evaluation of each:

  1. Actors and Directors who Cooperated At Least Three Times:

    • Correctness: The solution correctly groups by actor_id and director_id, counts the timestamps, and filters for counts >= 3.
    • Time Complexity: O(n) for grouping and counting, which is efficient.
    • Space Complexity: O(n) in the worst case, but likely less since we're filtering.
    • Code Quality: The code is clean and straightforward. The variable name 'num_unique' could be more descriptive.
    • Efficiency: The solution is efficient, though reset_index() could be avoided if not needed.
  2. Daily Leads and Partners:

    • Correctness: Correctly groups by date_id and make_name, calculates nunique for lead_id and partner_id, and renames columns appropriately.
    • Time Complexity: O(n) for grouping and counting unique values, which is efficient.
    • Space Complexity: O(n) for the grouped data.
    • Code Quality: Good, but the variable name 'num_unique' is misleading since we're counting unique values, not just counting.
    • Efficiency: The solution is efficient. No major optimizations needed.
  3. Group Sold Products by the Date:

    • Correctness: Correctly groups by sell_date, calculates number of unique products and concatenates them in sorted order.
    • Time Complexity: O(n log n) due to the sorting operation, which is acceptable.
    • Space Complexity: O(n) for the grouped data.
    • Code Quality: Good, but the lambda function could be replaced with a predefined function for better readability.
    • Efficiency: The solution is efficient. The sort could potentially be done during the groupby operation.

General feedback:

  • The student demonstrates good understanding of pandas operations.
  • Variable naming could be more descriptive in some cases.
  • The solutions are efficient and handle the problems correctly.
  • The code is well-structured and follows pandas best practices.
  • Adding docstrings to the functions would improve readability and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants