You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspdpd.show_versions()
df=pd.DataFrame({'a':['01','02','03','04'], 'b':[5,6,7,8]})
dfdf.dtypesdf.to_excel('tmp.xlsx')
df.to_csv('tmp.csv')
# Load without specifying dtypes or converterloaded_df1=pd.read_excel('tmp.xlsx')
loaded_df1loaded_df1.dtypes# Load specifying dtypesloaded_df2=pd.read_excel('tmp.xlsx',dtypes={'a':str,'b':int})
loaded_df2loaded_df2.dtypes# Note that column 'a' is still of type int# Load specifying convertersloaded_df3=pd.read_excel('tmp.xlsx',dtypes={'a':str,'b':int})
loaded_df3loaded_df3.dtypes# Note that column 'a' is now a string, as anticipated# Load specifying an invalid kwargloaded_df4=pd.read_excel('tmp.xlsx', invalid_kwarg=['foo','bar'])
# Load using read_csv with an invalid kwarg (should raise a TypeError)loaded_df5=pd.read_csv('tmp.csv', invalid_kwarg=['foo','bar'])
Expected Output
This issue is related to #8212. The dtypes kwarg is not documented as an available kwarg for the read_excel documentation. However, it also does not raise an error as an invalid kwarg if specified. When used, it appears to be ignored, but it seems that raising an error would be more helpful to the user. I know that the converters kwarg should be used instead, but this isn't obvious if you are used to read_csv and read_table, which both rely on the dtypes kwarg. More broadly, it seems like read_excel allows for any kwarg, unlike read_csv or read_table.
output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.0.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-51-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
Code Sample, a copy-pastable example if possible
Expected Output
This issue is related to #8212. The dtypes kwarg is not documented as an available kwarg for the read_excel documentation. However, it also does not raise an error as an invalid kwarg if specified. When used, it appears to be ignored, but it seems that raising an error would be more helpful to the user. I know that the converters kwarg should be used instead, but this isn't obvious if you are used to read_csv and read_table, which both rely on the dtypes kwarg. More broadly, it seems like read_excel allows for any kwarg, unlike read_csv or read_table.
output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.0.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-51-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.17.1
nose: 1.3.7
pip: 8.0.3
setuptools: 20.1.1
Cython: 0.23.4
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
IPython: 4.0.2
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.4.6
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.2
lxml: 3.5.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.11
pymysql: None
psycopg2: None
Jinja2: None
The text was updated successfully, but these errors were encountered: