question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: read_excel not accepting encoding on 1.1.0

See original GitHub issue
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

# Your code here
def date_parse(value: str) -> datetime.datetime:
    return datetime.datetime.strptime(value.strip(), "%d/%m/%y")

df = pd.read_excel(
    filepath,
    encoding="iso-8859-1",
    usecols="B",
    date_parser=date_parse,
    skiprows=4,
)

Problem description

TypeError: read_excel() got an unexpected keyword argument ‘encoding’.

Expected Output

No error, as in previous versions.

Output of pd.show_versions()

------------------
commit           : d9fff2792bf16178d4e450fe7384244e50635733
python           : 3.8.2.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.4.0-42-generic
Version          : #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : pt_BR.UTF-8

pandas           : 1.1.0
numpy            : 1.18.5
pytz             : 2020.1
dateutil         : 2.8.1
pip              : 20.1
setuptools       : 41.2.0
Cython           : None
pytest           : 6.0.1
hypothesis       : None
sphinx           : 3.2.0
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : 2.11.2
IPython          : None
pandas_datareader: None
bs4              : None
bottleneck       : None
fsspec           : None
fastparquet      : None
gcsfs            : None
matplotlib       : None
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : None
pytables         : None
pyxlsb           : None
s3fs             : None
scipy            : None
sqlalchemy       : None
tables           : None
tabulate         : None
xarray           : None
xlrd             : 1.2.0
xlwt             : None
numba            : None```

</details>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:44 (31 by maintainers)

github_iconTop GitHub Comments

7reactions
bsnresearchercommented, Jul 11, 2021

The encoding argument is very important. I want to come back “encoding=”.

Excel application windows edition’s default encoding ShiftJIS(cp932). The export file(.xlsx) causes character corruption in dealing with pandas in MacOS because the os default encoding UTF8.

5reactions
boardtccommented, Jan 20, 2021

I have language accents in my excel, when reading from csv I can pass encoding=‘utf-8’. Why would Pandas remove this ability from reading excel files? This is a blocker for me now, all of my accented words are getting garbled when read in from excel. The after my wrangling I am writing to csv and get UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\U0001f3c0’ in position 69: character maps to <undefined> What is the workaround that allowed you to remove this functionality?

Note my excel is a .xlsx export from Google sheets.

I am disappointed nobody responded to Matthew over 2 months ago, what hope is there for me? Since this is closed should I open a new issue? I will wait a couple of hours.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when reading excel (xls) files into dataframe [duplicate]
This was changed in pandas 1.1.0. Encoding is no longer a parameter for read_excel() . read_excel() no longer takes **kwds arguments.
Read more >
Reading Poorly Structured Excel Files with Pandas
This article describes how to use pandas and openpyxl to read ranges of data from poorly structured Excel files.
Read more >
What's new in 1.2.0 (December 26, 2020) - Pandas
The xlwt package for writing old-style .xls excel files is no longer maintained. The xlrd package is now only for reading old-style .xls...
Read more >
How to Read, Write XLSX File in Java - Apach POI Example
In order to read Excel file, you need to first download Apache POI Jar files, without these your code will neither compiler nor...
Read more >
How To Encode Utf8 In Pandas Excel As Source - ADocLib
Pandas Read Excel Without Index! study focus room education degrees courses structure BUG: readexcel not accepting encoding on 1.1.0 Issue.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found