Python Forum
Can't read text file with pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't read text file with pandas
#1
Hi.
I would like help to:
1-I need know why I cannot read a text file with pandas.
2-If possible read this file, get all rows that have C100 value and insert into new xls file.
Size file is 12MB
Link to my file:
https://drive.google.com/file/d/1MfkVJtb...sp=sharing

import pandas as pd

df = pd.read_csv("01Sped.txt", sep = "|", header=None)
print(df)
Erro:
Error:
Traceback (most recent call last): File "C:\Users\user\Downloads\readTxtFile.py", line 3, in <module> df = pd.read_csv("01Sped.txt", sep = "|", header=None) .................... File "pandas\_libs\parsers.pyx", line 899, in pandas._libs.parsers.TextReader.read File "pandas\_libs\parsers.pyx", line 914, in pandas._libs.parsers.TextReader._read_low_memory File "pandas\_libs\parsers.pyx", line 968, in pandas._libs.parsers.TextReader._read_rows File "pandas\_libs\parsers.pyx", line 955, in pandas._libs.parsers.TextReader._tokenize_rows File "pandas\_libs\parsers.pyx", line 2172, in pandas._libs.parsers.raise_parser_error pandas.errors.ParserError: Error tokenizing data. C error: Expected 17 fields in line 12001, saw 31
Thank you!!
Reply


Messages In This Thread
Can't read text file with pandas - by zinho - May-23-2019, 12:43 PM
RE: Can't read text file with pandas - by zinho - May-23-2019, 02:37 PM
RE: Can't read text file with pandas - by zinho - May-23-2019, 05:31 PM
RE: Can't read text file with pandas - by zinho - May-15-2020, 02:23 PM
RE: Can't read text file with pandas - by azajali43 - May-24-2020, 06:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,628 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
Smile How to further boost the data read write speed using pandas tjk9501 1 1,215 Nov-14-2022, 01:46 PM
Last Post: jefsummers
  How to import an xml file to Pandas sjhazard 0 2,312 Jun-08-2021, 08:19 PM
Last Post: sjhazard
  Read json array data by pandas vipinct 0 1,886 Apr-13-2020, 02:24 PM
Last Post: vipinct
  Can python read Marathi text files and summarize them? mcp111 0 1,763 Mar-18-2020, 08:58 AM
Last Post: mcp111
  Read file Into array with just $0d as Newline lastyle 5 3,276 Feb-03-2020, 11:58 PM
Last Post: lastyle
  getting trailing zeros with 1 during pandas read fullstop 1 3,543 Jan-05-2020, 04:01 PM
Last Post: ichabod801
  Read csv file from Yahoo Finance ian 3 4,584 Sep-22-2019, 06:47 AM
Last Post: ndc85430
  Read Text From Image Nitesh 0 15,015 Jul-25-2019, 02:35 PM
Last Post: Nitesh
  Read Nested JSON with pandas.io.json palo173 4 9,500 Apr-29-2019, 01:25 PM
Last Post: palo173

Forum Jump:

User Panel Messages

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