1

I'm testing django using file uploads. Was facing a strange issue, when despide which encoding I choose, I'm always getting same error message that pandas is trying to decode with UTF-8

pd.read_csv(file, encoding="cp1257")

getting

*** UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 6: unexpected end of data

Same for various different encodings, engines.

1

1 Answer 1

2

The problem seems to be solved with

import io
pd.read_csv(io.BytesIO(file.read()), encoding="cp1257")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.