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

Initial query wrapping #19

Merged
merged 5 commits into from
Apr 9, 2024
Merged

Initial query wrapping #19

merged 5 commits into from
Apr 9, 2024

Conversation

dougbrn
Copy link
Collaborator

@dougbrn dougbrn commented Apr 5, 2024

Change Description

Solution Description

This PR wraps the pandas query function. Before executing any query, it first checks the input query string for spacing between the various components. I needed this to essentially be able to split each component apart and check to see if it was targeting a nested column using the "nested_frame.nested_column" access pattern. It then builds a set of subqueries for each targeted layer. At the moment, I limited this to only having one layer be targetable at a time, but we could allow multiple queries to execute within the query call down the road.

One note, is that using the "." is slightly overloaded in Pandas eval syntax. You can use "column.property" within eval normally. We override this by splitting on it and removing the dot, so some subset of queries full functionality is probably limited. I think this implementation should be sufficient for the MVP however, and we can come back to make this more robust in a later stage of the project.

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

Bug Fix Checklist

  • My fix includes a new test that breaks as a result of the bug (if possible)
  • My change includes a breaking change
    • My change includes backwards compatibility and deprecation warnings (if possible)

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

github-actions bot commented Apr 5, 2024

Before [70afe87] After [9a4e0d7] Ratio Benchmark (Parameter)
3.17±0.4s 3.99±0.9s ~1.26 benchmarks.time_computation
552 304 0.55 benchmarks.mem_list

Click here to view all benchmarks.

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.75%. Comparing base (70afe87) to head (b6e205b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   91.59%   92.75%   +1.15%     
==========================================
  Files          11       12       +1     
  Lines         488      552      +64     
==========================================
+ Hits          447      512      +65     
+ Misses         41       40       -1     

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

@dougbrn dougbrn marked this pull request as ready for review April 5, 2024 19:10
@dougbrn dougbrn requested a review from hombit April 5, 2024 19:12
@dougbrn dougbrn changed the title WIP: Initial query wrapping Initial query wrapping Apr 5, 2024
Copy link
Collaborator

@hombit hombit left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

src/nested_pandas/nestedframe/utils.py Outdated Show resolved Hide resolved
src/nested_pandas/nestedframe/utils.py Outdated Show resolved Hide resolved
@dougbrn dougbrn merged commit 00be464 into main Apr 9, 2024
11 checks passed
@dougbrn dougbrn deleted the wrap_query branch April 9, 2024 16:47
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