Skip to main content

Convert LIBSVM data to csv format.

Project description

libsvm2csv

Installation

pip install libsvm2csv

Convert LIBSVM format into CSV

from libsvm2csv import convert
convert("libsvm-data.txt", "data.csv")

libsvm-data.txt

1 qid:1 2:0.14  4:0.97  5:0.45
0 qid:1 1:0.15  3:0.75  2:0.24  4:0.6
2 qid:1 1:0.71  2:0.36  3:0.58  5:0.12
0 qid:2 4:0.79  3:0.01  2:0.05  5:0.27
3 qid:2 1:0.42  2:0.79  3:0.30  4:0.76

data.csv

index,target,qid,1,2,3,4,5
0,1,1,0,0.14,0,0.97,0.45
1,0,1,0.15,0.24,0.75,0.6,0
2,2,1,0.71,0.36,0.58,0,0.12
3,0,2,0,0.05,0.01,0.79,0.27
4,3,2,0.42,0.79,0.30,0.76,0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libsvm2csv-0.1.4.tar.gz (3.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page