#NEWLINE# def loadarff( f ) : #NEWLINE# #INDENT# '\n    Read an arff file.\n\n    The data is returned as a record array, which can be accessed much like\n    a dictionary of numpy arrays.  For example, if one of the attributes is\n    called \'pressure\', then its first 10 data points can be accessed from the\n    ``data`` record array like so: ``data[\'pressure\'][0:10]``\n\n\n    Parameters\n    ----------\n    f : file-like or str\n       File-like object to read from, or filename to open.\n\n    Returns\n    -------\n    data : record array\n       The data of the arff file, accessible by attribute names.\n    meta : `MetaData`\n       Contains information about the arff file such as name and\n       type of attributes, the relation (name of the dataset), etc...\n\n    Raises\n    ------\n    ParseArffError\n        This is raised if the given file is not ARFF-formatted.\n    NotImplementedError\n        The ARFF file has an attribute which is not supported yet.\n\n    Notes\n    -----\n\n    This function should be able to read most arff files. Not\n    implemented functionality include:\n\n    * date type attributes\n    * string type attributes\n\n    It can read files with numeric and nominal attributes.  It cannot read\n    files with sparse data ({} in the file).  However, this function can\n    read files with missing data (? in the file), representing the data\n    points as NaNs.\n\n    Examples\n    --------\n    >>> from scipy.io import arff\n    >>> from cStringIO import StringIO\n    >>> content = """\n    ... @relation foo\n    ... @attribute width  numeric\n    ... @attribute height numeric\n    ... @attribute color  {red,green,blue,yellow,black}\n    ... @data\n    ... 5.0,3.25,blue\n    ... 4.5,3.75,green\n    ... 3.0,4.00,red\n    ... """\n    >>> f = StringIO(content)\n    >>> data, meta = arff.loadarff(f)\n    >>> data\n    array([(5.0, 3.25, \'blue\'), (4.5, 3.75, \'green\'), (3.0, 4.0, \'red\')],\n          dtype=[(\'width\', \'<f8\'), (\'height\', \'<f8\'), (\'color\', \'|S6\')])\n    >>> meta\n    Dataset: foo\n    \twidth\'s type is numeric\n    \theight\'s type is numeric\n    \tcolor\'s type is nominal, range is (\'red\', \'green\', \'blue\', \'yellow\', \'black\')\n\n    ' #NEWLINE# if hasattr ( f , 'read' ) : #NEWLINE# #INDENT# ofile = f #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ofile = open ( f , 'rt' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return _loadarff ( ofile ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# if ( ofile is not f ) : #NEWLINE# #INDENT# ofile . close ( )