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

[ENH] variable arguments support in select #1288

Merged
merged 17 commits into from
Oct 2, 2023
Merged

Conversation

samukweku
Copy link
Collaborator

@samukweku samukweku commented Sep 18, 2023

PR Description

Please describe the changes proposed in the pull request:

  • support variable arguments, similar to select_columns/select_rows
  • ultimately make a single function for column/index selection
  • deprecation notice for select_columns and select_rows

This PR improves the select function.

PR Checklist

Please ensure that you have done the following:

  1. PR in from a fork off your branch. Do not PR from <your_username>:dev, but rather from <your_username>:<feature-branch_name>.
  1. If you're not on the contributors list, add yourself to AUTHORS.md.
  1. Add a line to CHANGELOG.md under the latest version header (i.e. the one that is "on deck") describing the contribution.
    • Do use some discretion here; if there are multiple PRs that are related, keep them in a single line.

Automatic checks

There will be automatic checks run on the PR. These include:

  • Building a preview of the docs on Netlify
  • Automatically linting the code
  • Making sure the code is documented
  • Making sure that all tests are passed
  • Making sure that code coverage doesn't go down.

Relevant Reviewers

Please tag maintainers to review.

@samukweku samukweku self-assigned this Sep 18, 2023
@ericmjl
Copy link
Member

ericmjl commented Sep 18, 2023

@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

Merging #1288 (8756009) into dev (43a606a) will increase coverage by 0.74%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev    #1288      +/-   ##
==========================================
+ Coverage   96.64%   97.38%   +0.74%     
==========================================
  Files          78       78              
  Lines        4172     4176       +4     
==========================================
+ Hits         4032     4067      +35     
+ Misses        140      109      -31     

Copy link
Member

@ericmjl ericmjl left a comment

Choose a reason for hiding this comment

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

Approving! Thank you for the excellent work as always, @samukweku!

@ericmjl
Copy link
Member

ericmjl commented Sep 23, 2023

Let's give it 1-2 more days to see if @thatlittleboy might have some bandwidth to review. (If not, no pressure, Jeremy!) We can merge otherwise.

Copy link
Contributor

@thatlittleboy thatlittleboy left a comment

Choose a reason for hiding this comment

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

Hiya, I'm leaving a comment for now (not a formal request for changes). I'm not fully sold on the internal API unfortunately, let me know what you think!

janitor/functions/select.py Outdated Show resolved Hide resolved
janitor/functions/select.py Outdated Show resolved Hide resolved
janitor/functions/select.py Outdated Show resolved Hide resolved
janitor/functions/select.py Outdated Show resolved Hide resolved
janitor/functions/utils.py Outdated Show resolved Hide resolved
@samukweku
Copy link
Collaborator Author

Hiya, I'm leaving a comment for now (not a formal request for changes). I'm not fully sold on the internal API unfortunately, let me know what you think!

Good to have you around @thatlittleboy appreciate your PR reviews

@ericmjl
Copy link
Member

ericmjl commented Sep 28, 2023

@samukweku when you feel the PR is in a good state, let me know and I'll take a second look!

@samukweku
Copy link
Collaborator Author

samukweku commented Sep 28, 2023

@ericmjl yes it is ready for another review. Thanks

@ericmjl
Copy link
Member

ericmjl commented Sep 29, 2023

The pull request includes several changes across multiple files:

  1. In AUTHORS.md, a new contributor, kianmeng, has been added.
  2. In CHANGELOG.md, a new enhancement has been added under the 'Unreleased' section, stating that the select function now supports variable arguments.
  3. In currency_column_to_numeric.py, the _clean_accounting_column function has been removed and its logic has been incorporated directly into the currency_column_to_numeric function.
  4. In filter.py, the logic for converting the column_name to datetime has been simplified and the conditions for filtering dates have been updated.
  5. In select.py, the select_columns and select_rows functions have been marked for deprecation in a future release and users are advised to use the jn.select function instead. The select function has been updated to support variable arguments and the ability to invert selection.
  6. In utils.py, the _select function has been updated to handle the new arguments and inversion functionality introduced in the select function.
  7. In test_filter_date.py, the tests have been updated to reflect the changes in the filter.py file.
  8. In test_pivot_wider.py, comments have been added to indicate that the pivot_wider function will be deprecated in a future release and users are advised to use pd.pivot instead.
  9. In test_select.py, new tests have been added to check the new functionality in the select function.
  10. In test_sort_timestamps_monotonically.py, the test has been updated to use pd.concat instead of df.append.
  11. The file test_clean_accounting_column.py has been deleted as the _clean_accounting_column function it was testing has been removed.

AUTHORS.md Show resolved Hide resolved
@ericmjl
Copy link
Member

ericmjl commented Sep 29, 2023

Okie dokes, re-approved!

Copy link
Contributor

@thatlittleboy thatlittleboy left a comment

Choose a reason for hiding this comment

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

I'll pre-approve, just a couple of minor revision points. Thanks Sam!

head-swing-iloveit-thumbsup

janitor/functions/select.py Show resolved Hide resolved
janitor/functions/select.py Outdated Show resolved Hide resolved
tests/functions/test_select.py Outdated Show resolved Hide resolved
@ericmjl
Copy link
Member

ericmjl commented Oct 2, 2023

GitBot Summary of Changes

The pull request includes several changes across multiple files:

  1. AUTHORS.md: Added a new contributor, kianmeng, to the list.
  2. CHANGELOG.md: Updated the changelog to reflect the enhancement of the select function to support variable arguments.
  3. currency_column_to_numeric.py: Refactored the currency_column_to_numeric function to improve efficiency and readability. Removed the _clean_accounting_column function and integrated its functionality directly into the main function.
  4. filter.py: Simplified the date filtering logic and improved readability.
  5. select.py: Deprecated the select_columns and select_rows functions and advised users to use the select function instead. Also, added the ability to invert selection of index/columns and provided the option to specify the axis for selection.
  6. utils.py: Refactored the _select function to improve readability and efficiency.
  7. test_filter_date.py: Updated tests to reflect changes in the date filtering logic.
  8. test_pivot_wider.py: Updated tests to reflect changes in the pivot_wider function.
  9. test_select.py: Added new tests for the updated select function.
  10. test_sort_timestamps_monotonically.py: Updated tests to reflect changes in the sort_timestamps_monotonically function.
  11. Removed test_clean_accounting_column.py as the _clean_accounting_column function was removed.

cc: @samukweku, please check for correctness!

@ericmjl ericmjl merged commit 3f4a034 into dev Oct 2, 2023
6 checks passed
@ericmjl
Copy link
Member

ericmjl commented Oct 2, 2023

Merged!

@samukweku samukweku deleted the samukweku/select_single_call branch November 18, 2023 02:12
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.

3 participants