Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jzwinck opened this issue Jul 23, 2017 · 1 comment
Closed

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

jzwinck opened this issue Jul 23, 2017 · 1 comment
Labels
Docs IO CSV read_csv, to_csv

Comments

@jzwinck
Copy link
Contributor

jzwinck commented Jul 23, 2017

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

@jreback
Copy link
Contributor

jreback commented Jul 23, 2017

already clarified by #16950

@jreback jreback closed this as completed Jul 23, 2017
@jreback jreback added Docs IO CSV read_csv, to_csv labels Jul 23, 2017
@jreback jreback added this to the No action milestone Jul 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs IO CSV read_csv, to_csv
Projects
None yet
Development

No branches or pull requests

2 participants