datatable.Frame.head()

Return the first n rows of the frame.

If the number of rows in the frame is less than n, then all rows are returned.

This is a convenience function and it is equivalent to DT[:n, :].

Parameters

n
int

The maximum number of rows to return, 10 by default. This number cannot be negative.

return
Frame

A frame containing the first up to n rows from the original frame, and same columns.

Examples

DT = dt.Frame(A=["apples", "bananas", "cherries", "dates", "eggplants", "figs", "grapes", "kiwi"]) DT.head(4)
A
str32
0apples
1bananas
2cherries
3dates

See also

  • .tail() – return the last n rows of the Frame.