BUG: head and tail not dropping groups with nan
- [x] closes #45089
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit) for how to run them
- [x] whatsnew entry

We could also create a specific function for this.

Also that nth respects ``as_index`` while it is ignored by ``head`` and ``tail`` looks inconsistent
> We could also create a specific function for this.

what does this mean Adjusting the mask for the dropna flag in a dedicated function, because the place I put this is a bit awkward 