Python Forum
Newbie, can't load csv file.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie, can't load csv file.
#1
I keep getting the same error on this. The first row of the csv is column names, but they are not in double quotes. Might that be the issue?

(
Quote:base) C:\Users\DSNoS>python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from datascience import Table
>>> casesissuesproviders=Table.read_table('C:/users/dsnos/desktop/CaseIssuesProviders.csv')
Traceback (most recent call last):
File "pandas/_libs/parsers.pyx", line 1175, in pandas._libs.parsers.TextReader._convert_tokens
File "pandas/_libs/parsers.pyx", line 1281, in pandas._libs.parsers.TextReader._convert_with_dtype
File "pandas/_libs/parsers.pyx", line 1297, in pandas._libs.parsers.TextReader._string_convert
File "pandas/_libs/parsers.pyx", line 1539, in pandas._libs.parsers._string_box_utf8
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 7: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\DSNoS\Anaconda3\lib\site-packages\datascience\tables.py", line 132, in read_table
df = pandas.read_table(filepath_or_buffer, *args, **vargs)
File "C:\Users\DSNoS\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 709, in parser_f
return _read(filepath_or_buffer, kwds)
File "C:\Users\DSNoS\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 455, in _read
data = parser.read(nrows)
File "C:\Users\DSNoS\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 1069, in read
ret = self._engine.read(nrows)
File "C:\Users\DSNoS\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 1839, in read
data = self._reader.read(nrows)
File "pandas/_libs/parsers.pyx", line 902, in pandas._libs.parsers.TextReader.read
File "pandas/_libs/parsers.pyx", line 924, in pandas._libs.parsers.TextReader._read_low_memory
File "pandas/_libs/parsers.pyx", line 1001, in pandas._libs.parsers.TextReader._read_rows
File "pandas/_libs/parsers.pyx", line 1130, in pandas._libs.parsers.TextReader._convert_column_data
File "pandas/_libs/parsers.pyx", line 1182, in pandas._libs.parsers.TextReader._convert_tokens
File "pandas/_libs/parsers.pyx", line 1281, in pandas._libs.parsers.TextReader._convert_with_dtype
File "pandas/_libs/parsers.pyx", line 1297, in pandas._libs.parsers.TextReader._string_convert
File "pandas/_libs/parsers.pyx", line 1539, in pandas._libs.parsers._string_box_utf8
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 7: invalid start byte
>>>

changed encoding and it worked. Sorry for the bother. I should google first. Newbie frantic thrashing, what can I say.
Reply
#2
Quote:UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 7: invalid start byte

Is telling you it has encountered a character it cannot decode. It would be helpful to see the relevant code and a few lines of the .csv file.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
Look at this Thread,and see if you can pick up some tips.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Fatal Python error: initfsencoding: unable to load the file system codec gauravbhardwajee 12 28,034 Apr-30-2020, 07:45 PM
Last Post: barrpath
  Is there any way to properly load fixed width file into a dataframe using Pandas? vicky53 1 3,031 Mar-29-2019, 06:04 PM
Last Post: Larz60+
  Load .abf file and for analysis with Pandas finalcode 0 2,982 Nov-10-2018, 09:51 AM
Last Post: finalcode
  save 2d array to file and load back ian 3 18,155 May-18-2018, 05:00 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020