-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
Closing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
I often work with time series and want to see at a glance where and how they begin and end.
Feature Description
That's why I registered an "ends" accessor, which provides me with both ends in one call as a combination of "head" and "tail". It's really simple, but very usefull to me:
class _EndsAccessor:
def __init__(self, pandas_obj):
self._obj = pandas_obj
def __call__(self, n=2):
return pd.concat([self._obj.head(n), self._obj.tail(n)])
@pd.api.extensions.register_dataframe_accessor("ends")
class EndsAccessorDataframe(_EndsAccessor):
pass
@pd.api.extensions.register_series_accessor("ends")
class EndsAccessorSeries(_EndsAccessor):
pass
Alternative Solutions
We leave it as it is and I continue using the solution shown above.
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Closing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member