pandas.io.parsers.TextFileReader.read#

TextFileReader.read(nrows=None)[source]#

Read rows from the file into a DataFrame.

Advances the internal cursor by the number of rows returned, so successive calls yield later rows of the file. Used with readers created via read_csv() or read_table() with iterator=True or chunksize set.

Parameters:
nrowsint, optional

Number of rows to read. If None, read until end of file. Ignored when the underlying engine is "pyarrow", which always reads the full file.

Returns:
DataFrame

The parsed rows.

See also

TextFileReader.get_chunk

Read the next chunk of rows.

read_csv

Read a comma-separated values (csv) file into a DataFrame.

Examples

>>> with pd.read_csv("data.csv", iterator=True) as reader:
...     df = reader.read()