pandas.read_fwf

pandas 3.1.1 · Input and output · function

Parse columns whose positions are fixed within each text line.

Call syntax

pd.read_fwf(…) Full signature
pd.read_fwf(
    filepath_or_buffer,
    *,
    colspecs='infer',
    widths=None,
    infer_nrows=100,
    iterator=False,
    chunksize=None,
    **kwds,
)

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
colspecs Optional
Keyword only
Default 'infer'
list of tuple (int, int) or 'infer'.
widths Optional
Keyword only
Default None
list of int
infer_nrows Optional
Keyword only
Default 100
int
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.

**kwds Optional
Additional keyword arguments

Returns

DataFrame or TextFileReader