Skip to content

feat: add dataframe.insert #770

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 3 commits into from
Jun 11, 2024
Merged

feat: add dataframe.insert #770

merged 3 commits into from
Jun 11, 2024

Conversation

Genesis929
Copy link
Collaborator

@Genesis929 Genesis929 commented Jun 7, 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)

Fixes #<issue_number_goes_here> 🦕

Docs screenshot:
https://screenshot.googleplex.com/44Hv89QdsGxbKaS
https://screenshot.googleplex.com/8sdZyxEcCzxd2ac

@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 Jun 7, 2024
@Genesis929 Genesis929 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 8, 2024
@bigframes-bot bigframes-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 8, 2024
@Genesis929 Genesis929 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 8, 2024
@bigframes-bot bigframes-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 8, 2024
@Genesis929 Genesis929 added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 10, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 10, 2024
@Genesis929 Genesis929 marked this pull request as ready for review June 10, 2024 17:30
@Genesis929 Genesis929 requested review from a team as code owners June 10, 2024 17:30
@Genesis929 Genesis929 requested a review from GarrettWu June 10, 2024 17:30
column_count = len(self.columns)
if loc > column_count:
raise IndexError(
f"index {loc} is out of bounds for axis 0 with size {column_count}"
Copy link
Contributor

Choose a reason for hiding this comment

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

axis 0 doesn't exist in this context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but this is the message pandas used for insert for some reason. Maybe just mean the columns.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.


block = df._get_block()
value_columns = typing.cast(List, block.value_columns)
value_columns = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Just List.insert() can do the job.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

@Genesis929 Genesis929 requested a review from GarrettWu June 10, 2024 19:57
@Genesis929 Genesis929 merged commit e8bab68 into main Jun 11, 2024
23 checks passed
@Genesis929 Genesis929 deleted the insert-huanc branch June 11, 2024 17:36
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