pandas.read_table

pandas 3.1.1 · Input and output · function

Read delimited text into a DataFrame. The default delimiter is a tab.

Call syntax

pd.read_table(…) Full signature
pd.read_table(
    filepath_or_buffer,
    *,
    sep=…,
    delimiter=…,
    header='infer',
    names=…,
    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=…,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
filepath_or_buffer Required
Positional or keyword
str, path object or file-like object
sep Optional
Keyword only
str

Specify the separator between fields or string pieces.

delimiter Optional
Keyword only
str
header Optional
Keyword only
Default 'infer'
int, Sequence of int, 'infer' or None

Define which row or rows provide column names, or control whether to write them.

names Optional
Keyword only
Sequence of Hashable

Supply explicit names for labels, fields, or levels.

index_col Optional
Keyword only
Default None
Hashable, Sequence of Hashable or False

Identify the column or columns whose values should become the row index.

usecols Optional
Keyword only
Default None
Sequence of Hashable or Callable

Select a subset of source columns by name, position, or a callable.

dtype Optional
Keyword only
Default None
dtype or dict of {Hashable : dtype}

Choose the data type for the input conversion or result.

engine Optional
Keyword only
Default None
{'c', 'python', 'pyarrow'}

Choose the implementation that performs the operation.

converters Optional
Keyword only
Default None
dict of {Hashable : Callable}

Map column labels or positions to conversion functions.

true_values Optional
Keyword only
Default None
list

Add source values that should become boolean True.

false_values Optional
Keyword only
Default None
list

Add source values that should become boolean False.

skipinitialspace Optional
Keyword only
Default False
bool
skiprows Optional
Keyword only
Default None
int, list of int or Callable

Skip selected input rows before creating the DataFrame.

skipfooter Optional
Keyword only
Default 0
int

Skip this many lines at the end of the input.

nrows Optional
Keyword only
Default None
int

Limit the number of rows to read or display.

na_values Optional
Keyword only
Default None
Hashable, Iterable of Hashable or dict of {Hashable : Iterable}

Add input markers that should be interpreted as missing.

keep_default_na Optional
Keyword only
Default True
bool

Choose whether pandas' built-in missing strings are recognized along with custom markers.

na_filter Optional
Keyword only
Default True
bool
skip_blank_lines Optional
Keyword only
Default True
bool
parse_dates Optional
Keyword only
Default None
bool, None, list of Hashable

Choose whether to interpret selected fields as dates during a read.

date_format Optional
Keyword only
Default None
str or dict of column -> format

Specify datetime parsing or formatting directives such as "%Y-%m-%d".

dayfirst Optional
Keyword only
Default False
bool

Prefer the day before the month when interpreting ambiguous date text.

cache_dates Optional
Keyword only
Default True
bool
iterator Optional
Keyword only
Default False
bool

Request an iterable reader so data can be consumed in pieces.

chunksize Optional
Keyword only
Default None
int

Set how many rows to read or write in each batch.

compression Optional
Keyword only
Default 'infer'
str or dict

Choose whether and how to compress or decompress data.

thousands Optional
Keyword only
Default None
str (length 1)

Identify the character separating groups of digits.

decimal Optional
Keyword only
Default '.'
str (length 1)

Identify the character used as the decimal mark.

lineterminator Optional
Keyword only
Default None
str (length 1)

Specify the character or string ending each record.

quotechar Optional
Keyword only
Default '"'
str (length 1)

Specify the character used to quote a delimited field.

quoting Optional
Keyword only
Default 0
{0, 1, 2, 3}

Choose a quoting rule using the csv module's quoting constants.

doublequote Optional
Keyword only
Default True
bool

Choose whether doubled quote characters denote a single quote inside a field.

escapechar Optional
Keyword only
Default None
str (length 1)

Specify the character that escapes an otherwise special character.

comment Optional
Keyword only
Default None
str (length 1)

Identify the comment character used when parsing text.

encoding Optional
Keyword only
Default None
str

Name a text encoding such as "utf-8".

encoding_errors Optional
Keyword only
Default 'strict'
str

Choose how to handle text that cannot be encoded or decoded.

dialect Optional
Keyword only
Default None
str or csv.Dialect
on_bad_lines Optional
Keyword only
Default 'error'
{'error', 'warn', 'skip'} or Callable
low_memory Optional
Keyword only
Default True
bool
memory_map Optional
Keyword only
Default False
bool
float_precision Optional
Keyword only
Default None
{'high', 'legacy', 'round_trip'}
storage_options Optional
Keyword only
Default None
dict

Pass storage-backend options such as connection settings or HTTP headers.

dtype_backend Optional
Keyword only
{'numpy_nullable', 'pyarrow'}

Choose nullable NumPy-backed dtypes or Arrow-backed dtypes.

Returns

DataFrame or TextFileReader