Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
python csv2libsvm.py: AttributeError: el objeto '_csv.reader' no tiene atributo 'siguiente'

Quiero convertir un archivo csv en un archivo de formato disperso con csv2libsvm.py ( https://github.com/zygmuntz/phraug/blob/master/csv2libsvm.py ).

El archivo CSV contiene 37 atributos + la etiqueta (última columna). no contiene encabezado ni índice. Exp de la primera fila: 63651000000.0,63651000000.0,153.1,0,0,0,0,0,0,5,1,0,4,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1

Al ingresar la siguiente línea de comando: python csv2libsvm.py Z.csv data.txt 38 1

Tuve el siguiente error:

 Traceback (most recent call last): File "csv2libsvm.py", line 47, in <module> headers = reader.next() AttributeError: '_csv.reader' object has no attribute 'next'

¿Tienes alguna idea sobre el problema?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Esto se debe a las diferencias entre python 2 y python 3. Use la función incorporada next en python 3. Es decir, escriba next(reader) en lugar de reader.next() en la línea 47. Además, debe abrir el archivo en el modo de texto. Entonces, cambie la línea 47 como i = open( input_file, 'r' ) .

over 4 years ago · Santiago Trujillo Report

0

Para Python 3.x:

Utilice next(reader) en lugar de lector. reader.next()

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!