Registry / ai-ml / liac-arff

liac-arff

JSON →
library2.5.0pypypi✓ verified 84d ago

liac-arff is a Python library for reading and writing ARFF (Attribute-Relation File Format) files, commonly used in WEKA machine learning toolkits. Current version 2.5.0 is the last to support Python 2. It supports sparse ARFF, data generators, and standard Java escape sequences. Release cadence is irregular, with about 1-2 releases per year.

pip install liac-arff
INSTALL
IMPORT
SIG · LIAC-ARFF
L
liac-arff
ai-mlpythonv2.5.0
Install
2.4s avg
Import
20ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.022s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.018s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

arff
import arff
load
data = arff.load(open('file.arff'))
from arff import load
load is a function in the arff module, not a top-level import. Import the module first.

Load an ARFF file and access its attributes and data.

import arff # Load ARFF file with open('example.arff') as f: data = arff.load(f) print(data['attributes']) print(data['data']) # Load with generator (lazy loading) with open('example.arff') as f: for row in arff.load(f, return_type='generator'): print(row)
Debug
Known issues
gotchaThe `load()` function expects a file-like object, not a file path. Use `open()` or `io.StringIO`.
fix
Use `with open('file.arff') as f: data = arff.load(f)`
affects: all
gotchaWhen using `return_type='generator'`, the returned object is a generator that yields rows incrementally, but the `attributes` key is only available after the first iteration or after exhausting the generator. Accessing `data['attributes']` before iterating may raise an error or return an empty list.
fix
Iterate over the generator first or use `list(data['data'])` to consume it, then access `data['attributes']`.
affects: >=2.4.0
breakingPython 2.7 support removed in version 2.5.0. Users on Python 2 must stay on version 2.4.0 or earlier.
fix
Upgrade to Python 3.5+ or pin liac-arff to <=2.4.0.
affects: >=2.5.0
Errors
Common errors & fixes
AttributeError: module 'arff' has no attribute 'load'
Attempting to import 'load' directly from arff (e.g., `from arff import load`) but the correct usage is to import the module and call arff.load.
fix
Use `import arff` then `data = arff.load(...)`
TypeError: expected str, bytes or os.PathLike object, not _io.BufferedReader
Passing an open file handle where a path string is expected (often from mixing with other libraries).
fix
Ensure you pass the file object to `arff.load()`, not the path. If a path is needed, open it first: `with open(path) as f: arff.load(f)`
Upgrade
Version history
2.5.0latest on PyPI · released Aug 31, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
14
Resources
liac-arff — pip install liac-arff · libregistry