pyjanitor icon indicating copy to clipboard operation
pyjanitor copied to clipboard

implement `expand` method for pandas

Open samukweku opened this issue 1 year ago • 2 comments

PR Description

Please describe the changes proposed in the pull request:

  • implement expand method for pandas DataFrame
  • user can build DataFrame to compute missing values/gaps, instead of using complete (more power to the user)
  • updates to expand_grid - MultiIndex columns are generated only if the key lengths of the dictionaries differ (maybe a tuple was used, or the length of tuples differ)
  • expand_grid now uses np.indices for faster generation of indices, which is used to explode into a cartesian.
  • df_key is deprecated. The columns of df will be used instead as keys.

This PR resolves #1293 .

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.

  • @ericmjl

samukweku avatar Jun 08 '24 08:06 samukweku

🚀 Deployed on https://deploy-preview-1371--pyjanitor.netlify.app

ericmjl avatar Jun 08 '24 08:06 ericmjl

I'll fix the failures after other PRs are ok.

samukweku avatar Jun 08 '24 08:06 samukweku