bigframes.pandas.Series.head#

Series.head(n:int=5)Series[source]#

Return the firstn rows.

This function returns the firstn rows for the object basedon position. It is useful for quickly testing if your objecthas the right type of data in it.

For negative values ofn, this function returnsall rows except the last|n| rows, equivalent todf[:n].

If n is larger than the number of rows, this function returns all rows.

Examples:

>>>df=bpd.DataFrame({'animal':['alligator','bee','falcon','lion',...'monkey','parrot','shark','whale','zebra']})>>>df    animal0  alligator1        bee2     falcon3       lion4     monkey5     parrot6      shark7      whale8      zebra[9 rows x 1 columns]

Viewing the first 5 lines:

>>>df.head()    animal0  alligator1        bee2     falcon3       lion4     monkey[5 rows x 1 columns]

Viewing the firstn lines (three in this case):

>>>df.head(3)    animal0  alligator1        bee2     falcon[3 rows x 1 columns]

For negative values ofn:

>>>df.head(-3)    animal0  alligator1        bee2     falcon3       lion4     monkey5     parrot[6 rows x 1 columns]
Parameters:

n (int,default 5) – Default 5. Number of rows to select.

Returns:

The firstn rows of the caller object.

Return type:

bigframes.pandas.DataFrame orbigframes.pandas.Series

On this page

This Page