datamatrix
index
/home/lb/Coding/datamatrix/datamatrix.py

 
Modules
       
copy
csv
os
sys

 
Classes
       
__builtin__.object
DataMatrix
EmptyMatrix

 
class DataMatrix(__builtin__.object)
    Pythonic implementation of R's data.frame structure.
This class loads a file or a file-like structure then it 
transforms it into a dictionary of (row name, value) tuples for
each column. Optionally only column values can be retrieved and
at the same time single lines can be queried.
Missing values are inputted as NAs.
 
The column used for row names (row_names) can be specified,
otherwise rows are numbered sequentially. If the file has
an header (default True), it is used to name the fields, otherwise the
fields are numbered sequentially, with the first field
being "x" (like R does). 
 
Other options include the delimiter, line terminator and quoting,
and they are passed directly to the csv DictReader instance which will
read the file. See the csv module documentation for more details.
 
Notable methods are:
    - getColumn - returns a specific column
    - getRow - returns a specific row
    - view - Outputs a tab-delimited view of a number of
        lines. Start line and how much to show are configurable.
    - append - add a column (of the same length and with the same identifiers)
         to the matrix, kind of equivalent to R's cbind.
 
  Methods defined here:
__contains__(self, key)
__delitem__(self, key)
__getitem__(self, key)
__init__(self, fh=None, row_names=None, header=True, delimiter='\t', lineterminator='\n', quoting=0)
__iter__(self)
__len__(self)
__setitem__(self, key, item)
__str__(self)
append(self, other)
getColumn(self, key, column_name=False)
Gets a specific column, without the
identifier. The result is returned as a list.
Optionally the column name can be printed.
getRow(self, row_number, columns='all')
Returns a specific row, identified from the 
row number, as a list. You can specify how many
columns are outputted (default: all) with the columns parameter.
view(self, lines=10, start_at=1, *args, **kwargs)
Method used to print on-screen the table. 
The number of lines, and thee starting line can be
configured via the start_at and lines parameters.
Optional parameters can be sent to getRow to 
select which columns are printed.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class EmptyMatrix(DataMatrix)
    DtaMatrix variant that does not depend on a file.
 
 
Method resolution order:
EmptyMatrix
DataMatrix
__builtin__.object

Methods inherited from DataMatrix:
__contains__(self, key)
__delitem__(self, key)
__getitem__(self, key)
__init__(self, fh=None, row_names=None, header=True, delimiter='\t', lineterminator='\n', quoting=0)
__iter__(self)
__len__(self)
__setitem__(self, key, item)
__str__(self)
append(self, other)
getColumn(self, key, column_name=False)
Gets a specific column, without the
identifier. The result is returned as a list.
Optionally the column name can be printed.
getRow(self, row_number, columns='all')
Returns a specific row, identified from the 
row number, as a list. You can specify how many
columns are outputted (default: all) with the columns parameter.
view(self, lines=10, start_at=1, *args, **kwargs)
Method used to print on-screen the table. 
The number of lines, and thee starting line can be
configured via the start_at and lines parameters.
Optional parameters can be sent to getRow to 
select which columns are printed.

Data descriptors inherited from DataMatrix:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
writeMatrix(data_matrix, fname=None, delimiter='\t', lineterminator='\n', quoting=0, *args, **kwargs)
Function that saves DataMatrix objects to text files. 
A file name is a mandatory parameter, along with the data matrix
object you want to use. You can optionally pass more parameters to 
getRows to select which columns are saved.

 
Data
        division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)