Skip to content

DOC: read_fwf() is documented as supporting delimiter, but doesn't #17056

Closed
@jzwinck

Description

@jzwinck

The docstring and online manual for read_fwf() say:

delimiter : str, default None
Alternative argument name for sep.

But in fact, sep does nothing in this function, while delimiter has some effect, though perhaps not intentional:

import io
import pandas as pd

pd.read_fwf(io.StringIO('foo,bar\n1,2'),delimiter=',')
pd.read_fwf(io.StringIO('foo,bar\n1,2'),sep=',')

Both are nonsensical and should really produce an error, but they actually produce two different results:

   foo  bar
0  1,2  NaN
  foo,bar
0     1,2

The documentation should be cleaned up to not suggest the use of delimiter with read_fwf() unless it is actually useful and intended (in which case sep should be made to do the same, and documented).

Discovered by https://stackoverflow.com/questions/45257881/python-transform-string-into-dataframe-using-tab-as-separator/

Pandas 0.20: http://pandas.pydata.org/pandas-docs/version/0.20/generated/pandas.read_fwf.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions