Code Sample, a copy-pastable example if possible
skip = [0] + [i for i in range(3, 81)]
df = pd.read_excel('excel_file.xls', skiprows=skip)
Problem description
The dataframe only returns the header from row 1 and row 2 is missing.
Note: changing skip to [0] + [i for i in range(4, 81)] returns a the dataframe with two rows as expected. The problem occurs when I only want one row.
Expected Output
A dataframe where row 1 is the header and row 2 is the first row entry.
Output of pd.show_versions()
# Paste the output here pd.show_versions() here
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.0.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.11.3
scipy: 0.18.1
statsmodels: 0.6.1
xarray: None
IPython: 5.1.0
sphinx: 1.5.1
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: 3.2.2
numexpr: 2.6.1
matplotlib: 2.0.0
openpyxl: 2.4.1
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.2
bs4: 4.5.3
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.1.6
pymysql: 0.7.9.None
psycopg2: None
jinja2: 2.9.4
boto: 2.45.0
pandas_datareader: None
Comment From: chris-b1
Can you make this a copy paste-table example (can attach the file). Simple experiment suggests this is working OK
In [16]: df = pd.DataFrame([
...: ['junk', 'row'],
...: ['a', 'b'],
...: [1, 2],
...: [3, 4]])
In [17]: df.to_excel('tmp.xlsx', index=False, header=False)
In [18]: pd.read_excel('tmp.xlsx', skiprows=[0, 2])
Out[18]:
a b
0 3 4
Comment From: dwsmith1983
@chris-b1 This example works. However, my table doesn't work. I cannot attach the table since this is for work.
Comment From: chris-b1
It doesn't need to be your exact data, can you dummy up something that reproduces the problem?
Comment From: chris-b1
Closing as not reproducible.