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()orread_table()withiterator=Trueorchunksizeset.- 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_chunkRead the next chunk of rows.
read_csvRead a comma-separated values (csv) file into a DataFrame.
Examples
>>> with pd.read_csv("data.csv", iterator=True) as reader: ... df = reader.read()