Loading [MathJax]/extensions/tex2jax.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

NotesParametersRaisesReturns
loadarff(f)

The data is returned as a record array, which can be accessed much like a dictionary of NumPy arrays. For example, if one of the attributes is called 'pressure', then its first 10 data points can be accessed from the data record array like so: data['pressure'][0:10]

Notes

This function should be able to read most arff files. Not implemented functionality include:

It can read files with numeric and nominal attributes. It cannot read files with sparse data ({} in the file). However, this function can read files with missing data (? in the file), representing the data points as NaNs.

Parameters

f : file-like or str

File-like object to read from, or filename to open.

Raises

ParseArffError

This is raised if the given file is not ARFF-formatted.

NotImplementedError

The ARFF file has an attribute which is not supported yet.

Returns

data : record array

The data of the arff file, accessible by attribute names.

meta : `MetaData`

Contains information about the arff file such as name and type of attributes, the relation (name of the dataset), etc.

Read an arff file.

Examples

from scipy.io import arff
from io import StringIO
content = """
@relation foo
@attribute width  numeric
@attribute height numeric
@attribute color  {red,green,blue,yellow,black}
@data
5.0,3.25,blue
4.5,3.75,green
3.0,4.00,red
"""
f = StringIO(content)
data, meta = arff.loadarff(f)
data
meta
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/io/arff/_arffread.py#727
type: <class 'function'>
Commit: