Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "how" argument to add_nested #125

Merged
merged 4 commits into from
Jul 26, 2024
Merged

Add "how" argument to add_nested #125

merged 4 commits into from
Jul 26, 2024

Conversation

wilsonbb
Copy link
Contributor

@wilsonbb wilsonbb commented Jul 25, 2024

Change Description

Adds a how argument in add_nested to align with a traditional pandas join and in preparation from the change from add_nested to join_nested (see #120)

  • My PR includes a link to the issue that I am addressing

Solution Description

The previous add_nested implementation packed the nested frame into a single column which is then assigned to our base layer. Here we simply add this column using a traditional join and then make use of the join's how argument. Since our previous implementation produces the same results as the "left" argument, I was concerned that replacing the single column assignment with a join might decrease performance. However a preliminary benchmarking shows no notable change.

Screenshot 2024-07-25 at 1 17 40 PM

Also of note here is that for the case of how="right", the nature of the packer still means that the result is implicitly using the index of our base layer but now drops values from it that were not present in the index of our "right" nested layer.

Code Quality

  • I have read the Contribution Guide
  • My code follows the code style of this project
  • My code builds (or compiles) cleanly without any errors or warnings
  • My code contains relevant comments and necessary documentation

Project-Specific Pull Request Checklists

New Feature Checklist

  • I have added or updated the docstrings associated with my feature using the NumPy docstring format
  • I have updated the tutorial to highlight my new feature (if appropriate)
  • I have added unit/End-to-End (E2E) test cases to cover my new feature
  • My change includes a breaking change
    • My change includes backwards compatibility and deprecation warnings (if possible)

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.44%. Comparing base (bcaf1b8) to head (183b1b9).
Report is 54 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
- Coverage   99.44%   99.44%   -0.01%     
==========================================
  Files          14       14              
  Lines         898      896       -2     
==========================================
- Hits          893      891       -2     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jul 25, 2024

Before [bcaf1b8] After [1714c0a] Ratio Benchmark (Parameter)
29.9±0.8ms 32.3±3ms 1.08 benchmarks.AssignSingleDfToNestedSeries.time_run
9.01±0.2ms 9.59±0.1ms 1.06 benchmarks.NestedFrameAddNested.time_run
6.30±0.08ms 6.62±0.07ms 1.05 benchmarks.NestedFrameQuery.time_run
57.4±1ms 59.1±2ms 1.03 benchmarks.ReassignHalfOfNestedSeries.time_run
91.5M 92.2M 1.01 benchmarks.NestedFrameQuery.peakmem_run
90.2M 90.9M 1.01 benchmarks.NestedFrameReduce.peakmem_run
1.11±0ms 1.12±0ms 1.01 benchmarks.NestedFrameReduce.time_run
278M 281M 1.01 benchmarks.ReassignHalfOfNestedSeries.peakmem_run
260M 261M 1 benchmarks.AssignSingleDfToNestedSeries.peakmem_run
86.9M 87.3M 1 benchmarks.NestedFrameAddNested.peakmem_run

Click here to view all benchmarks.

@wilsonbb wilsonbb marked this pull request as ready for review July 25, 2024 21:53
@wilsonbb wilsonbb requested a review from dougbrn July 25, 2024 21:55
Copy link
Collaborator

@dougbrn dougbrn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice looks good!

@wilsonbb wilsonbb merged commit bc85088 into main Jul 26, 2024
11 checks passed
@wilsonbb wilsonbb deleted the add_nested_how branch July 26, 2024 21:54
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