1

I try to convert my CSV file to LIBSVM by using phraug python scripts. (https://github.com/zygmuntz/phraug)

Here is my dataset, which contains a label on first position and a header: https://www.dropbox.com/s/j4wsh5pde76o8ax/adclickwithoutid.csv

I saw a posting here on stackoverflow(Converting CSV file to LIBSVM compatible data file using python) and tried his code:

Alexanders-iMac:documents arigge$ python csv2libsvm.py adclickwithoutid.csv libsvm.data 1 True
Traceback (most recent call last):
  File "csv2libsvm.py", line 51, in <module>
    new_line = construct_line( label, line )
  File "csv2libsvm.py", line 15, in construct_line
    if float( item ) == 0.0:

What am I missing?

Community
  • 1
  • 1
user3400996
  • 73
  • 1
  • 9

1 Answers1

0

You might be missing the meaning of 4 of the post Converting CSV file to LIBSVM compatible data file using python

As I saw your data, the first element seems target. Right? So I tried:

python csv2libsvm.py iris.csv libsvm.data 0 True

It produced 2G libsvm data from your 1.4G csv data.

Community
  • 1
  • 1
emesday
  • 6,078
  • 3
  • 29
  • 46
  • I tried your command line but still get following error message: admin$ python csv2libsvm.py adclickwithoutid.csv libsvm.data 0 True Traceback (most recent call last): File "csv2libsvm.py", line 51, in new_line = construct_line( label, line ) File "csv2libsvm.py", line 15, in construct_line if float( item ) == 0.0: ValueError: could not convert string to float: Did you maybe do it for the iris.csv file as indicated by your command line? – user3400996 Jul 29 '14 at 15:24