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

BUG: add names parameter to read_excel #12895

Closed
wants to merge 3 commits into from
Closed

Conversation

OXPHOS
Copy link
Contributor

@OXPHOS OXPHOS commented Apr 13, 2016

@OXPHOS OXPHOS changed the title add names parameter to read_excel add names parameter to read_excel Apr 13, 2016
@jreback jreback added Bug IO Excel read_excel, to_excel labels Apr 14, 2016
@jreback jreback added this to the 0.18.1 milestone Apr 14, 2016
@@ -455,6 +455,14 @@ def test_read_one_empty_col_with_header(self):
expected_header_zero = DataFrame(columns=[0], dtype='int64')
tm.assert_frame_equal(actual_header_zero, expected_header_zero)

def test_set_column_names_in_parameter(self):
excel = self.get_excelfile('testcolnameset')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add the issue number here as a comment

@OXPHOS
Copy link
Contributor Author

OXPHOS commented Apr 14, 2016

Currently, set argument index_col = none can disable taking column names from excel file.
I can also refactor excel.py so that old column names can be automatically dropped when names=names

Example
If we write DataFrame([[1, 'foo'], [2, 'bar'], [3, 'baz']], columns=['A', 'B']) to excel and then read,

[In] : read_excel(reader, 'DataFrame', names=['A', 'B'])
[out]: 
   A    B
0  a    b
1  1  foo
2  2  bar
3  3  baz
[In] : read_excel(reader, 'DataFrame', index_col=None, names=['A', 'B'])
[out]: 
   A    B
0  1  foo
1  2  bar
2  3  baz

@OXPHOS
Copy link
Contributor Author

OXPHOS commented Apr 14, 2016

Will remove test files

@OXPHOS OXPHOS changed the title add names parameter to read_excel BUG: add names parameter to read_excel Apr 14, 2016
@jreback
Copy link
Contributor

jreback commented Apr 14, 2016

this PR is about a single issue - don't add other things

@OXPHOS
Copy link
Contributor Author

OXPHOS commented Apr 15, 2016

Hey may I ask what is going on with codecov/patch? It pops up some files I didn't touch at all.

@jreback jreback closed this in 6c692ae Apr 16, 2016
@jreback
Copy link
Contributor

jreback commented Apr 16, 2016

yeah, code cov was set a bit high.

thanks for the PR!

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_excel with names keyword argument not working
2 participants