Skip to content

ENH: add peek function #36277

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

Closed
wants to merge 7 commits into from
Closed

Conversation

Quetzalcohuatl
Copy link

@Quetzalcohuatl Quetzalcohuatl commented Sep 10, 2020

added peek, which is essentially a concatenation of head and tail functions. The reason I add, is because often for sorted data, you are interested in looking at both the head and tail simultaneously to see the min/max range.

@pep8speaks
Copy link

pep8speaks commented Sep 10, 2020

Hello @Quetzalcohuatl! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-09-10 22:26:09 UTC

@Quetzalcohuatl Quetzalcohuatl changed the title add peek function [ENH] add peek function Sep 10, 2020
@Quetzalcohuatl Quetzalcohuatl changed the title [ENH] add peek function ENH: add peek function Sep 10, 2020
@WillAyd
Copy link
Member

WillAyd commented Sep 10, 2020

This has been discussed previously in #18691 - not sure we want to add this to the API

@WillAyd WillAyd added the Needs Discussion Requires discussion from core team before further action label Sep 10, 2020
@jreback
Copy link
Contributor

jreback commented Sep 12, 2020

yeah -1 on adding this. We already already pretty much show this when doing a repr.

@jreback
Copy link
Contributor

jreback commented Sep 12, 2020

thanks @Quetzalcohuatl plently of formatting issues if you would like to tackle.

@jreback jreback closed this Sep 12, 2020
@Quetzalcohuatl
Copy link
Author

@jreback We have head and tail even though you can already already show that by doing .iloc[n:]. I think this would be a very useful option to add instead of having to type the very long with pd.option_context('display.max_rows'=50)... I can never remember the phrase to use, and this would be a quick and easy way to do it. Even in the linked issue someone made a function def show that they use in every notebook. Nobody wants to be copy pasting the repr every time they want to show different amounts of rows. Sometimes you only want head(1) and tail(1), sometimes you want head(25) tail(25) which will fit within the default 50 rows displayed in Jupyter Notebook. Please reconsider.

@jreback
Copy link
Contributor

jreback commented Sep 19, 2020

@Quetzalcohuatl see the linked issue - happy to take an example function (see @TomAugspurger example) / doc string update

this is useful but we cannot have everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Requires discussion from core team before further action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an ends function that shows both head and tail of the df
4 participants