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

docs(python): Clarify behavior of DataFrame.rows_by_key #14149

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

BGR360
Copy link
Contributor

@BGR360 BGR360 commented Feb 1, 2024

When I read the docs for this method for the first time, it was not at all clear to me how the returned dictionary was constructed until I scrolled all the way down to the examples. And even then, it took me a little while to understand.

I edited the description to be a bit more clear about how the dictionary is structured, while trying not to be too redundant with the examples and parameter docs.

Also, while I was here, I added a little blurb to the rows docs as well.

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars labels Feb 1, 2024
@BGR360
Copy link
Contributor Author

BGR360 commented Feb 1, 2024

Question: could we be any more precise about the return type of rows_by_key? It's pretty vague:

def rows_by_key(...) -> dict[Any, Iterable[Any]]

Compared to rows:

def rows(...) -> list[tuple[Any, ...]] | list[dict[str, Any]]:

That being said, the return type of rows_by_key is certainly more complicated and has more variants than that of rows.

@stinodego
Copy link
Member

@alexander-beedie would you mind reviewing this one (and the comment about the return type)?

@stinodego stinodego changed the title docs(python): clarify behavior of DataFrame.rows_by_key. docs(python): Clarify behavior of DataFrame.rows_by_key Feb 8, 2024
BGR360 and others added 2 commits February 9, 2024 22:28
When I read the docs for this method for the first time, it was not at
all clear to me how the returned dictionary was constructed until I
scrolled all the way down to the examples. And even then, it took me
a little while to understand.

I edited the description to be a bit more clear about how the dictionary
is structured, while trying not to be too redundant with the examples and
parameter docs.

Also, while I was here, I added a little blurb to the `rows` docs as well.
@alexander-beedie
Copy link
Collaborator

Question: could we be any more precise about the return type of rows_by_key? It's pretty vague:

Possibly, but it would need quite a few @overload decorators to cover all of the permutations; I'll see what I can do ;)

@alexander-beedie alexander-beedie merged commit c14e87f into pola-rs:main Feb 9, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants