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
Some problems with list in read_excel() #15133
Comments
Sorry, I don't entirely understand the issue. Could you include the tracebacks so we can see what's happening? Can you narrow down what the problem is? |
|
As documentation says I can use list as argument in read_excel(). |
Hello. Do tracebacks help understand problem? |
IIRC, to pass An easy way to test is to see if train = read_excel(
'Wilson_Schistosome Esophagus_differentially expressed transcripts.xlsx',
sheetname=[3], header=[0, 1], skip_footer=11) works, since |
I got this error as well, this seems to be due to some changes in version 0.19., because the code works in version 0.18.0 |
I got this error too, no matter how I set the header and sheetname parameters. I also tried on a one-sheet file, the same error is raised. |
I have this error too. Here is a demonstration of the error with a simple spreadsheet. The error only occurs when there is an empty column to the left of the first index col. Test 1 (fails): File 'excel_test1.xlsx' looks like this. input_data_filename = 'excel_test1.xlsx'
df = pd.read_excel(
os.path.join(data_dir, input_data_filename),
header=[3, 4],
index_col=[1, 2]
) Traceback:
Test 2 (works): File 'excel_test2.xlsx' looks like this. input_data_filename = 'excel_test2.xlsx'
df = pd.read_excel(
os.path.join(data_dir, input_data_filename),
header=[3, 4],
index_col=[0, 1]
) Output of test 2 is here. Would be happy to see a solution to this or advice on how to fix! |
Unfortunately it appears that this issue no longer has a excel file available for testing this bug. (Would be great if a reproducible example could be generated using pandas itself!). Going to close for now, but happy to reopen once we have a reproducible example |
I uploaded a couple of Excel files called I can still reproduce this error with
* Note: the folder in the GitHub repo linked above should not be named 'pandas' rename it locally to something else. |
I have as similar issue in 1.1.5 pandas version. But 1.5.3 works fine. |
i think the issue happened in the case the first row is missing entries for some columns. in that case using the default index_col=None would get confused. you can overcome this by setting index_col=0 and later retrieving the index as your first column |
Code Sample, a copy-pastable example if possible
OK
ValueError: Length of new names must be 1, got 2
ValueError: Length of new names must be 1, got 2
ValueError: Length of new names must be 1, got 2
Problem description
I am trying to read excel file ( https://github.com/ArtyomKaltovich/ikantam/blob/master/lab1/Wilson_Schistosome%20Esophagus_differentially%20expressed%20transcripts.xlsx ). But sometimes pandas does not accept list as parameters for read_excel.
Expected Output
Output of
pd.show_versions()
pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 32.3.1
Cython: None
numpy: 1.11.3
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.3
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
httplib2: 0.9.2
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: