Skip to content

Done Pandas10#27

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

Done Pandas10#27
sakshiasati17 wants to merge 1 commit intosuper30admin:mainfrom
sakshiasati17:main

Conversation

@sakshiasati17
Copy link

No description provided.

@super30admin
Copy link
Owner

The student's solution demonstrates a good understanding of pandas operations and grouping functionalities. Here's a detailed evaluation of each file:

  1. ActorsAndDirectorsWhoCooperatedAtLeastThreeTimes.py:

    • Correctness: The solution correctly groups by actor_id and director_id, counts their collaborations, and filters for those with at least 3 collaborations.
    • Time Complexity: O(n) for grouping and counting, where n is the number of rows in the DataFrame.
    • Space Complexity: O(m) where m is the number of unique actor-director pairs.
    • Code Quality: The code is clean and concise. The use of reset_index() is appropriate.
    • Efficiency: No major optimizations needed.
  2. DailyLeadsAndPartners.py:

    • Correctness: The solution correctly groups by date and make_name, then calculates unique leads and partners using nunique().
    • Time Complexity: O(n) for grouping and aggregation.
    • Space Complexity: O(m) where m is the number of unique date_id and make_name combinations.
    • Code Quality: Well-structured with clear column naming in the aggregation.
    • Efficiency: The solution is already efficient.
  3. GroupSoldProductsByTheDate.py:

    • Correctness: Correctly groups by sell_date, counts unique products, and creates a sorted comma-separated list of products.
    • Time Complexity: O(n + m log m) where n is the number of rows and m is the number of unique products per date (due to sorting).
    • Space Complexity: O(m) where m is the number of unique sell_date values.
    • Code Quality: Good, but could be improved by using a named function instead of lambda for better readability.
    • Efficiency: The sorting operation adds some overhead, but it's necessary for the output format.

General Strengths:

  • Consistent and clean pandas usage across all solutions
  • Proper use of groupby and aggregation functions
  • Good variable naming
  • Appropriate use of reset_index()

Areas for Improvement:

  • In GroupSoldProductsByTheDate.py, consider defining a named function for the products aggregation to improve readability.
  • Adding docstrings to explain the purpose of each function would be beneficial.
  • The solutions could include comments explaining the logic, especially for more complex operations.

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