0

I'm trying to read an Arabic and English data set Dataset, i need to separate the sentences (Arabic) in one list and the labels (English) in another array. I'm trying to read the .txt file as csv file to append each column in a single array , i try the following code but it gave me errors.

import pandas as pd
X = pd.read_csv('trans.arff.txt',encoding='utf-8')

Any ideas or solutions, Pleas!

Eng.sh
  • 15
  • 6
  • 1
    Did you look at line 134? You didn't show it to us. Are there nested quote marks? Note that the CSV standard uses double quotes to surround fields, not single. – Tim Roberts Nov 29 '21 at 23:48
  • @TimRoberts Do you mean i have to change all the single quotes with double quotes at the dataset? – Eng.sh Nov 30 '21 at 17:29
  • I'm saying your file is not a proper CSV file. The single quotes will be considered part of the data, not a delimiter. If you're going to use this file in several places, then yes you should fix the file. However, you can tell pandas to use single quotes instead by passing `quotechar="'"` as a parameter. – Tim Roberts Nov 30 '21 at 18:02
  • I see , thanks very much Tim! – Eng.sh Dec 01 '21 at 08:05

0 Answers0