smpl_io.head.headf

smpl_io.head.headf(*inps, open=True, n=1)

Returns the first n lines of fname.

Parameters

inpsstr, array_like, buffer

object to read from

nint, optional

number of lines to return, by default 1

Returns

str

first n lines of fname.

Examples

>>> from smpl_io import io
>>> import pandas as pd
>>> io.write("test.txt","hi\n1\n2\n3\n4\n")
>>> pd.read_csv(head("test.txt",n=2))
   hi
0   1
>>> pd.read_csv(head("test.txt",n=3))
   hi
0   1
1   2

Deprecated since version 1.0.6.1: This will be removed in 2.0.0. Use smpl_io.head(..., open=True)() instead.