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

Add docstrings #32

Merged
merged 9 commits into from
Mar 30, 2024
Merged

Add docstrings #32

merged 9 commits into from
Mar 30, 2024

Conversation

frnmst
Copy link
Contributor

@frnmst frnmst commented Mar 28, 2024

  • Add more docstrings in narwhals.dataframe.DataFrame class
  • Fix indentation in pre-commit file

frnmst added 3 commits March 28, 2024 17:46
- Use correct indentation for YAML file
- Add more docstrings
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

These docstrings are great, thank you so much @frnmst !

Looks like CI is failing with

E   ValueError: line 29 of the doctest for narwhals.dataframe.DataFrame.group_by has an invalid option: '+IGNORE_RESULT'

Just got some minor comments

n: Number of rows to return. If a negative value is passed, return all rows
except the last `abs(n)`.

See Also: `tail`, `glimpse`, `slice`
Copy link
Member

Choose a reason for hiding this comment

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

I don't this we have these yet, shall we remove this?


Arguments:
*columns: Names of the columns that should be removed from the dataframe.
Accepts column selector input.
Copy link
Member

Choose a reason for hiding this comment

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

We don't yet have column selectors in Narwhals, let's remove this for now

Comment on lines 618 to 637
Drop multiple columns by passing a selector.

>>> import polars.selectors as cs
>>> dframe = df.drop(cs.numeric())
>>> dframe
┌─────────────────────────────────────────────────┐
| Narwhals DataFrame |
| Use `narwhals.to_native()` to see native output |
└─────────────────────────────────────────────────┘
>>> nw.to_native(dframe)
shape: (3, 1)
┌─────┐
│ ham │
│ --- │
│ str │
╞═════╡
│ a │
│ b │
│ c │
└─────┘
Copy link
Member

Choose a reason for hiding this comment

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

let's remove this one

@frnmst
Copy link
Contributor Author

frnmst commented Mar 29, 2024

I think I fixed everything

@frnmst frnmst requested a review from MarcoGorelli March 29, 2024 15:36
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Thank you @frnmst ! Seriously good docstrings here, well done!

Little tip - I'd suggest making a new branch for each new PR (rather than opening PRs from main), it just makes it a bit easier to review

@MarcoGorelli
Copy link
Member

Also, I removed some doctest skips, as the doctests pass without them. For group-by, we can get a consistent output by adding a sort

@MarcoGorelli MarcoGorelli merged commit 8ec067d into narwhals-dev:main Mar 30, 2024
11 checks passed
@frnmst
Copy link
Contributor Author

frnmst commented Mar 30, 2024

Thank you @frnmst ! Seriously good docstrings here, well done!

Little tip - I'd suggest making a new branch for each new PR (rather than opening PRs from main), it just makes it a bit easier to review

Ok, will do

Also, I removed some doctest skips, as the doctests pass without them. For group-by, we can get a consistent output by adding a sort

Ok, I'll keep that in mind for the next docstrings

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.

2 participants