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

Simplify .nest["field"] = value #25

Merged
merged 3 commits into from
Apr 10, 2024
Merged

Simplify .nest["field"] = value #25

merged 3 commits into from
Apr 10, 2024

Conversation

hombit
Copy link
Collaborator

@hombit hombit commented Apr 10, 2024

Previously, series.nest["field"] = value would assign both "flat" value and "list" value. This PR drops it to simplify logic and interface of the accessor. List-arrays still may be assigned using series.nest.set_list_field("field_name", list_arrays).

It also makes series.nest["field"] (__getitem__) to use seiries.nest.get_flat_series

Fixes #16

Change Description

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

Solution Description

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)

Documentation Change Checklist

Build/CI Change Checklist

  • If required or optional dependencies have changed (including version numbers), I have updated the README to reflect this
  • If this is a new CI setup, I have added the associated badge to the README

Other Change Checklist

  • Any new or updated docstrings use 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 any changes
  • My change includes a breaking change
    • My change includes backwards compatibility and deprecation warnings (if possible)

hombit added 2 commits April 10, 2024 10:54
It removes the support of field assignment with list-arrays using
series.nest['field'] = ... syntax.
It is still supported via series.nest['field'].set_list_field('field', ...)
@hombit hombit requested a review from dougbrn April 10, 2024 15:08
Copy link

github-actions bot commented Apr 10, 2024

Before [136f2c5] After [3b875c7] Ratio Benchmark (Parameter)
1.63k 1.9k 1.16 benchmarks.mem_list
3.83±1s 3.51±1s 0.91 benchmarks.time_computation

Click here to view all benchmarks.

Copy link

codecov bot commented Apr 10, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 93.27%. Comparing base (136f2c5) to head (5cf131d).

Files Patch % Lines
src/nested_pandas/series/accessor.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
+ Coverage   92.93%   93.27%   +0.34%     
==========================================
  Files          13       13              
  Lines         566      565       -1     
==========================================
+ Hits          526      527       +1     
+ Misses         40       38       -2     

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

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.

Looks good!

src/nested_pandas/series/accessor.py Show resolved Hide resolved
@hombit hombit merged commit e43b187 into main Apr 10, 2024
11 checks passed
@hombit hombit deleted the simplify-nest-setitem branch April 10, 2024 18:20
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.

MVP: Change series.nest["field_name"] to expose "flat" series
2 participants