pandas 1.4.2

ParametersReturnsBackRef
head(self: 'NDFrameT', n: 'int' = 5) -> 'NDFrameT'

This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it.

For negative values of n, this function returns all rows except the last n rows, equivalent to df[:-n] .

Parameters

n : int, default 5

Number of rows to select.

Returns

same type as caller

The first n rows of the caller object.

Return the first n rows.

See Also

DataFrame.tail

Returns the last :None:None:`n` rows.

Examples

This example is valid syntax, but we were not able to check execution
>>> df = pd.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

Viewing the first 5 lines

This example is valid syntax, but we were not able to check execution
>>> df.head()
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey

Viewing the first n lines (three in this case)

This example is valid syntax, but we were not able to check execution
>>> df.head(3)
      animal
0  alligator
1        bee
2     falcon

For negative values of n

This example is valid syntax, but we were not able to check execution
>>> df.head(-3)
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey
5     parrot
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.measure._regionprops.regionprops_table skimage.measure._regionprops._props_to_dict

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/generic.py#5151
type: <class 'function'>
Commit: