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.

using pandas read csv cause gibberish

See original GitHub issue

Description of your problem

What steps will reproduce the problem?

  1. update spyder to 3.0.0.b7
  2. use read_csv in pandas and specify encoding in read_csv to gbk
  3. prepare a csv which filling with chinese character and encoded using gbk

What is the expected output? What do you see instead? in 3.0.0b6, we can see the right character, but in 3.0.0b7 we just get some gibberish

Please provide any additional information below

Versions and main components

  • Spyder Version:3.0.0b7
  • Python Version: Python 2.7.12 |Anaconda 4.0.0 (64-bit)
  • Operating system: win7

Dependencies

pandas 0.18.1 Please go to the menu entry Help > Optional Dependencies (or Help > Dependencies), press the button Copy to clipboard and paste the contents below:

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jitseniesencommented, Sep 23, 2016

I’m not sure whether this is what is meant, but I found one difference between beta6 and beta7 on Windows. It seems a different encoding is used when converting a DataFrame containing Unicode strings to a (non-Unicode) string.

I think this has the same cause as issue #3428: the missing __init__.py file. After copying utils/site from a Git clone to the Anaconda directory, beta7 has the same behaviour as beta6. So my guess is that this issue will disappear with the next release of Spyder.

0reactions
ccordoba12commented, Oct 15, 2016

Closing, as it seems this was fixed in Spyder 3.0 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandas cannot load data, csv encoding mystery - Stack Overflow
One thing you could do, is to read the CSV file as a binary, decode the binary string and replace the erroneous characters....
Read more >
pandas.read_csv — pandas 1.5.2 documentation
Read a comma-separated values (csv) file into DataFrame. Also supports optionally iterating or breaking of the file into chunks. Additional help can be...
Read more >
Read CSV Files In Pandas - YouTube
In this session, we will learn how to read CSV File in Pandas. CSV files are common file format that a data analyst...
Read more >
Removing Ï.., I and two dots or umlaut, when using read.csv in R
... some gibberish prepended to the first column name of a data frame when using read.csv. However, there's a good reason why this...
Read more >
Why does my exported CSV data get converted to weird ...
To be clear, the reason these problems occur is not due to the way Shift4Shop ... Fortunately, CSV files have the advantage of...
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