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

feat: ak.from_rdataframe should accept a single string 'columns'. #1956

Merged

Conversation

jpivarski
Copy link
Member

@jpivarski jpivarski commented Dec 6, 2022

This adds a guard, but it also introduces a way of calling ak.from_rdataframe (which was already partially in the documentation anyway).

It's to be expected that users will sometimes pass a single string into columns. When this happens, we could

  • raise an error to let them know that's wrong (it's already doing that, but the error message could be more clear)
  • turn a single string x into (x,), squashing the distinction between a string and a length-1 tuple of strings
  • use the single string interface to mean "I want an Awkward Array of a column" (what this function did before feat: retrieve multiple columns from RDataFrame in a single event loop #1625) and the collection of strings (even if there's only one of them) to mean "I want an Awkward Array of multiple columns." The latter will always be a record array, and if the collection has only one string in it, the record array will have only one field in it.

In this PR, I opted for the third case. It seems to me to be the most useful one.


📚 The documentation for this PR will be available at https://awkward-array.readthedocs.io/en/jpivarski-from_rdataframe-should-accept-a-single-string/ once Read the Docs has finished building 🔨

@jpivarski jpivarski requested a review from ianna December 6, 2022 00:41
@jpivarski jpivarski self-assigned this Dec 6, 2022
@jpivarski jpivarski added the pr-next-release Required for the next release label Dec 6, 2022
@jpivarski jpivarski linked an issue Dec 6, 2022 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Dec 6, 2022

Codecov Report

Merging #1956 (a2437fa) into main (d1ff4f1) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

Additional details and impacted files
Impacted Files Coverage Δ
src/awkward/operations/ak_from_rdataframe.py 17.64% <0.00%> (-25.22%) ⬇️
src/awkward/operations/ak_where.py 91.66% <0.00%> (-0.18%) ⬇️
src/awkward/_util.py 81.00% <0.00%> (-0.15%) ⬇️
src/awkward/operations/ak_broadcast_arrays.py 100.00% <0.00%> (ø)

Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks.

@agoose77
Copy link
Collaborator

agoose77 commented Dec 6, 2022

That's all reviewers! I'll merge.

@agoose77 agoose77 merged commit f72ca9c into main Dec 6, 2022
@agoose77 agoose77 deleted the jpivarski/from_rdataframe-should-accept-a-single-string branch December 6, 2022 09:39
@jpivarski jpivarski removed the pr-next-release Required for the next release label Feb 15, 2023
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.

from_rdataframe API should handle case that users pass single string
3 participants