Skip to main content

Python package for reading and writing Weka arff files

Project description

Weka arff file type reader for python.

http://code.google.com/p/arff/

http://code.google.com/p/arff/wiki/Documentation

Usage:

>>> import arff
>>> for row in arff.load('example.arff'):
... x = row.hair_color
... y = row[-1]
...
>>> print(list(arff.load('example.arff')))
[[Row(hair_color='blonde', age=17.2, patno=1),
Row(hair_color='blue', age=27.2, patno=2),
Row(hair_color='blue', age=18.2, patno=3)]



Where this is the example file:

@relation diabetics_data
@attribute hair_color {blonde, black, blue}
@attribute age real
@attribute patno integer
@data
blonde, 17.2, 1
blue, 27.2, 2
blue, 18.2, 3

-----
>>> data = [[1,2,'a'], [3, 4, 'john']]
>>> arff.dump('result.arff', data, relation="whatever", names=['num', 'day', 'title'])

results in the creation of this file:

@relation whatever
@attribute num integer
@attribute day integer
@attribute title string
@data
1,2,'a'
3,4,'john'


-----


supports arff types: numeric, integer, real, string
supports python types: int, str, float

in the future: dates

Tested on python 2.7 and 3.2

License: BSD, do what you wish with this. Could be awesome to hear if you found
it useful and/or you have suggestions. ubershmekel at gmail

Based on http://weka.wikispaces.com/ARFF+%28stable+version%29

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

arff-0.7.zip (7.0 kB view details)

Uploaded Source

File details

Details for the file arff-0.7.zip.

File metadata

  • Download URL: arff-0.7.zip
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for arff-0.7.zip
Algorithm Hash digest
SHA256 a2aa1aff2efcc482181eee21c33540b6119b45938fbfdd7dd1039957cb8a5605
MD5 a8619d259e6674edf29be26183b6c515
BLAKE2b-256 0153137311b0e9f5f0d6ea850099847ab2a783d82b8d74c77ab9a695e091b102

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page