Skip to content

feat: Add pivot_table for DataFrame. #473

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

Merged
merged 17 commits into from
Apr 9, 2024
Merged

feat: Add pivot_table for DataFrame. #473

merged 17 commits into from
Apr 9, 2024

Conversation

Genesis929
Copy link
Collaborator

@Genesis929 Genesis929 commented Mar 19, 2024

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Docs screenshot:
https://screenshot.googleplex.com/3FC5wP45SBFnPXi
https://screenshot.googleplex.com/BPfCJ6a5caWdvbi
https://screenshot.googleplex.com/Bd9XqEFv8X2d4sw

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Mar 19, 2024
@Genesis929 Genesis929 added the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 21, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 21, 2024
@Genesis929 Genesis929 marked this pull request as ready for review March 21, 2024 19:46
@Genesis929 Genesis929 requested review from a team as code owners March 21, 2024 19:46
@Genesis929 Genesis929 requested a review from shobsi March 25, 2024 17:40
Comment on lines 2088 to 2091
if isinstance(index, blocks.Label):
index = [index]
else:
index = list(index)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this have the correct behavior for tuples? Tuples are tricky because they can be interpreted as individual labels or list of labels.

... columns='Region'
... )
>>> pivot_table
Rating Sales
Copy link
Contributor

Choose a reason for hiding this comment

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

#[nit] is the indentation alright here, also below?


columns (str or object or a list of str):
Column to use to make new frame's columns.
aggfunc (str, default "mean"):
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] no newline like after other params

@@ -2554,6 +2554,34 @@ def test_df_pivot_hockey(hockey_df, hockey_pandas_df, values, index, columns):
pd.testing.assert_frame_equal(bf_result, pd_result, check_dtype=False)


@pytest.mark.parametrize(
("values", "index", "columns", "aggfunc"),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also test for the default values of these params?

@tswast tswast requested a review from TrevorBergeron March 29, 2024 21:06
@Genesis929 Genesis929 requested a review from a team as a code owner April 9, 2024 17:45
@Genesis929 Genesis929 requested a review from nicain April 9, 2024 17:45
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: m Pull request size is medium. labels Apr 9, 2024
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: xl Pull request size is extra large. labels Apr 9, 2024
@Genesis929 Genesis929 removed request for a team and nicain April 9, 2024 18:16
@Genesis929 Genesis929 merged commit 5f1d670 into main Apr 9, 2024
16 checks passed
@Genesis929 Genesis929 deleted the pivot-table-huanc branch April 9, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants