Read a table of fixed-width formatted lines into DataFrame.
Also supports optionally iterating or breaking of the file into chunks.
Additional help can be found in the online docs for IO Tools.
String, path object (implementing os.PathLike[str]
), or file-like object implementing a text read()
function.The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. A local file could be: file://localhost/path/to/table.csv
.
A list of tuples giving the extents of the fixed-width fields of each line as half-open intervals (i.e., [from, to[ ). String value âinferâ can be used to instruct the parser to try detecting the column specifications from the first 100 rows of the data which are not being skipped via skiprows (default=âinferâ).
A list of field widths which can be used instead of âcolspecsâ if the intervals are contiguous.
The number of rows to consider when letting the parser determine the colspecs.
Back-end data type applied to the resultant DataFrame
(still experimental). Behaviour is as follows:
"numpy_nullable"
: returns nullable-dtype-backed DataFrame
(default).
"pyarrow"
: returns pyarrow-backed nullable ArrowDtype
DataFrame.
Added in version 2.0.
Optional keyword arguments can be passed to TextFileReader
.
A comma-separated values (csv) file is returned as two-dimensional data structure with labeled axes.
See also
DataFrame.to_csv
Write DataFrame to a comma-separated values (csv) file.
read_csv
Read a comma-separated values (csv) file into DataFrame.
Examples
>>> pd.read_fwf('data.csv')
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4