diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index 127efe6a3d..607243f844 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -272,17 +272,73 @@ def head(self, n: int = 5): on position. It is useful for quickly testing if your object has the right type of data in it. - **Not yet supported** For negative values of `n`, this function returns + For negative values of `n`, this function returns all rows except the last `|n|` rows, equivalent to ``df[:n]``. If n is larger than the number of rows, this function returns all rows. + **Examples:** + + >>> import bigframes.pandas as bpd + >>> bpd.options.display.progress_bar = None + + >>> df = bpd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion', + ... 'monkey', 'parrot', 'shark', 'whale', 'zebra']}) + >>> df + animal + 0 alligator + 1 bee + 2 falcon + 3 lion + 4 monkey + 5 parrot + 6 shark + 7 whale + 8 zebra + + [9 rows x 1 columns] + + Viewing the first 5 lines: + + >>> df.head() + animal + 0 alligator + 1 bee + 2 falcon + 3 lion + 4 monkey + + [5 rows x 1 columns] + + Viewing the first `n` lines (three in this case): + + >>> df.head(3) + animal + 0 alligator + 1 bee + 2 falcon + + [3 rows x 1 columns] + + For negative values of `n`: + + >>> df.head(-3) + animal + 0 alligator + 1 bee + 2 falcon + 3 lion + 4 monkey + 5 parrot + + [6 rows x 1 columns] + Args: n (int, default 5): Default 5. Number of rows to select. Returns: - The first `n` rows of the caller object. + same type as caller: The first ``n`` rows of the caller object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) diff --git a/third_party/bigframes_vendored/pandas/core/series.py b/third_party/bigframes_vendored/pandas/core/series.py index 6b8dd1d64d..e6af1648fd 100644 --- a/third_party/bigframes_vendored/pandas/core/series.py +++ b/third_party/bigframes_vendored/pandas/core/series.py @@ -96,7 +96,20 @@ def index(self): @property def shape(self): - """Return a tuple of the shape of the underlying data.""" + """Return a tuple of the shape of the underlying data. + + **Examples:** + + >>> import bigframes.pandas as bpd + >>> bpd.options.display.progress_bar = None + + >>> s = bpd.Series([1, 4, 9, 16]) + >>> s.shape + (4,) + >>> s = bpd.Series(['Alice', 'Bob', bpd.NA]) + >>> s.shape + (3,) + """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @property