To provide the most recent news and documentation www.pymvpa.org reflects the
development 2.0 series (renamed 0.6 series) of PyMVPA. If you are interested in the
documentation of the previous stable 0.4 series of PyMVPA, please
visit v04.pymvpa.org.
class mvpa2.misc.bv.ColumnData(source, header=True, sep=None, headersep=None, dtype=<type 'float'>, skiplines=0)¶
Read data that is stored in columns of text files.
All read data is available via a dictionary-like interface. If
column headers are available, the column names serve as dictionary keys.
If no header exists an articfical key is generated: str(number_of_column).
Splitting of text file lines is performed by the standard split() function
(which gets passed the sep argument as separator string) and each
element is converted into the desired datatype.
Because data is read into a dictionary no two columns can have the same
name in the header! Each column is stored as a list in the dictionary.
Read data from file into a dictionary.
Parameters :
source : str or dict
If values is given as a string all data is read from the
file and additonal keyword arguments can be sued to
customize the read procedure. If a dictionary is passed
a deepcopy is performed.
header : bool or list of str
Indicates whether the column names should be read from the
first line (header=True). If header=False unique
column names will be generated (see class docs). If
header is a python list, it’s content is used as column
header names and its length has to match the number of
columns in the file.
sep : str or None
Separator string. The actual meaning depends on the output
format (see class docs).
headersep : str or None
Separator string used in the header. The actual meaning
depends on the output format (see class docs).
dtype : type or list(types)
Desired datatype(s). Datatype per column get be specified by
passing a list of types.
skiplines : int
Number of lines to skip at the beginning of the file.
If True a column header is written, using the column
keys. If False no header is written.
header_order : None or list of str
If it is a list of strings, they will be used instead
of simply asking for the dictionary keys. However
these strings must match the dictionary keys in number
and identity. This argument type can be used to
determine the order of the columns in the output file.
The default value is None. In this case the columns
will be in an arbitrary order.
sep : str, optional
String that is written as a separator between to data columns.
Quick search
Enter search terms or a module, class or function name.