Skip to content
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

read_excel with names keyword argument not working #12870

Closed
swkoh opened this issue Apr 11, 2016 · 2 comments
Closed

read_excel with names keyword argument not working #12870

swkoh opened this issue Apr 11, 2016 · 2 comments
Labels
Bug IO Excel read_excel, to_excel Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@swkoh
Copy link

swkoh commented Apr 11, 2016

With pandas 0.18, pd.read_excel() with name keyworkd does not work anymore. (pandas 0.17 works fine.) pandas 0.18 has a change to add names as a keyword argument in excel.py at line 76.

Code Sample, a copy-pastable example if possible

filename = 'test.xlsx'
column_names = ['field1', 'field2']
df = pd.read_excel(filename, index_col=None, names=column_names)

Expected Output

column_names associated with keyword argument names is supposed to pass down to kwds at C:\Python27\Lib\site-packages\pandas\io\excel.py:177.

kwds is supposed to carry the arguments from application (in this case, column_names above) but it does not get passed.

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.11.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.0
nose: None
pip: 8.1.1
setuptools: 18.3.2
Cython: 0.23.5
numpy: 1.11.0
scipy: None
statsmodels: None
xarray: None
IPython: 4.0.0
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.2.2
xlrd: 0.9.3
xlwt: 1.0.0
xlsxwriter: 0.7.3
lxml: None
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None

@jreback jreback added the IO Excel read_excel, to_excel label Apr 11, 2016
@jreback
Copy link
Contributor

jreback commented Apr 11, 2016

xref #11874 ; the names param was documented as it was in the signature but not the doc-string. But it appears to not be passed thru.

In [26]: df = DataFrame({'A' : [1,2,3], 'B' : ['foo','bar','baz']})

In [27]: df.to_excel('test.xlsx')

In [28]: pd.read_excel('test.xlsx')
Out[28]: 
   A    B
0  1  foo
1  2  bar
2  3  baz

In [29]: pd.read_excel('test.xlsx',names=['A'])
Out[29]: 
   A    B
0  1  foo
1  2  bar
2  3  baz

@jreback
Copy link
Contributor

jreback commented Apr 11, 2016

cc @jorisvandenbossche

@jreback jreback added this to the 0.18.1 milestone Apr 11, 2016
@jorisvandenbossche jorisvandenbossche added the Regression Functionality that used to work in a prior pandas version label Apr 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO Excel read_excel, to_excel Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants