Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Pandas · Function

pd.read_table

Reads a general delimited text file or file-like object into a pandas DataFrame, using tab separation by default. It can also expose incremental chunked parsing for large inputs.

How it works

Use read_table to parse a delimited text file or file-like object into a DataFrame. Configure the separator, column labels, types, missing-value handling, date parsing, encoding, and chunked iteration through keyword arguments.

Syntax

pandas.read_table(filepath_or_buffer, *, sep=<no_default>, delimiter=None, header='infer', names=<no_default>, index_col=None, usecols=None, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skipinitialspace=False, skiprows=None, skipfooter=0, nrows=None, na_values=None, keep_default_na=True, na_filter=True, skip_blank_lines=True, parse_dates=None, date_format=None, dayfirst=False, cache_dates=True, iterator=False, chunksize=None, compression='infer', thousands=None, decimal='.', lineterminator=None, quotechar='"', quoting=0, doublequote=True, escapechar=None, comment=None, encoding=None, encoding_errors='strict', dialect=None, on_bad_lines='error', low_memory=True, memory_map=False, float_precision=None, storage_options=None, dtype_backend=<no_default>)

Parameters

NameTypeDescription
filepath_or_bufferstr, path object, or file-like objectPath, URL, or file-like object containing the delimited data.
sepstr or regex-likeDelimiter used to split fields; the default is a tab.
headerint, list-like, or 'infer'Column names or positions to use as the header.
namesarray-likeOptional names for the resulting columns.
index_colint, str, sequence, or FalseColumn(s) to use as the row index.
usecolslist-like or callableSubset of columns to read.
dtypeDtype, mapping, or NoneColumn data types, globally or per column.
na_valuesscalar, str, list-like, or dictValues to recognize as missing, in addition to or instead of defaults.
keep_default_naboolWhether to include pandas' default missing-value markers.
na_filterboolWhether to detect missing-value markers.
parse_datesbool, list-like, or dictColumns to parse as dates.
chunksizeint, optionalNumber of rows per iteration; enables chunked reading.

Returns

DataFrame or TextFileReader. A DataFrame is returned for ordinary reads; iterator or chunked operation returns a text parser for incremental consumption.

Key points

  • Parses general delimited text and returns its tabular contents as a pandas DataFrame.
  • The input may be a filesystem path, URL, or file-like object.
  • String URLs are accepted, enabling direct reads from supported remote locations.

Common mistakes

  • For large inputs, iterator=True or chunksize changes the result from an immediately materialized DataFrame to chunk-oriented parsing.

Example: Read tab-separated text

import io
import pandas as pd

text = "name\tage\nAda\t36\nLinus\t55\n"
df = pd.read_table(io.StringIO(text), sep="\t")
print(df)

Reads tab-separated text from an in-memory file-like object into a DataFrame.

When to use it

Delimited-file ingestion

Import a tab-separated log, export, or dataset into a DataFrame.

Column projection

Read only required fields from a wide text file.

Chunked processing

Process a dataset larger than available memory in batches.

Typed and temporal parsing

Convert selected text fields into datetime or controlled pandas dtypes while parsing.

Interview questions

QWhat does pandas.read_table return?

read_table reads a general delimited file into a DataFrame. It accepts a path, URL, or file-like object through filepath_or_buffer, and defaults to tab separation.

Follow-up: How would you process a file that does not fit in memory? Set chunksize or use iterator=True, then consume the resulting text parser in pieces.

QWhich arguments control structure and types?

sep selects the delimiter, while header and names control column labels. usecols restricts the columns read, and dtype supplies desired column types.

Follow-up: How can parsing be made more memory-efficient? Select only needed columns with usecols, provide suitable dtypes, and use chunking when necessary.

QHow are missing values and dates handled?

Missing-value recognition is controlled by na_values, keep_default_na, and na_filter. Date conversion can be requested with parse_dates, with formatting controlled by date_format.

Follow-up: How would you avoid interpreting a token as missing? Disable default missing-value recognition or adjust the supplied na_values configuration.

  • pandas.read_csv
  • pandas.read_fwf
  • pandas.DataFrame
  • pandas.io.parsers.readers.TextFileReader

Source: pandas.read_table. Checked 2026-10-15.