DOC: GH42204: Change docstring for head and tail in core/generic.py
- [X] closes #42204
- [X] As test, ran scripts/validate_docstring.py with outputs
Docstring for "pandas.core.generic.NDFrame.head" correct. :)
Docstring for "pandas.core.generic.NDFrame.tail" correct. :)

Thanks for spotting the wrong usage of "function". For the examples I think it would be nicer to keep things as they are.
So what do you think about a different suggestion:

in head docstring:

For a negative integer `n = -k`, this function returns all rows except
the last `k` rows, equivalent to ``df[:-k]``.

in tail docstring:

For a negative integer `n = -k`, this function returns all rows except
the first `k` rows, equivalent to ``df[k:]``.

and no changes above the examples?

(If yes, would it be best to do this in a new pr?) I find that new wording harder to understand than your original, but curious if others have any thoughts (regardless, you can always just push new commits to this pr instead of opening a new one) +1 one on preferring the original wording (once modified based on existing feedback). Not sure it's necessary to adjust the examples - they use `n` (and that `n = -3` seems clear to me) instead of `k` so I don't find them confusing. To be honest I find the original wording (current master) clearer, except for needing to insert `|n|` instead of `n` in one place. Albeit the meaning is obvious.

However, if these new changes are to be implemented I would suggest using the current implementation:

 - change "the function ``df.head(-k)``" to just "``df.head(-k)``"
 - change `k` back to `n`. This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. Thanks for the PR, but seems like the original wording with some modifications is preferable to what is here currently. Additionally, looks like this PR has gone stale. Going to close, but please ping if you're still interested in working on this and we can reopen.