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
Comment From: jreback
already clarified by https://github.com/pandas-dev/pandas/pull/16950