loaders Package¶
base Module¶
An abstract loader class
- class maidenhair.loaders.base.BaseLoader(using=None, parser=None)[source]¶
Bases: object
A abstract loader class
Methods
glob(pathname[, using, unite, basecolumn, ...]) Load data from file matched with given glob pattern. load(filename[, using, parser]) Load data from file using a specified parser. - glob(pathname, using=None, unite=False, basecolumn=0, parser=None, with_filename=False, recursive=False, natsort=True, **kwargs)[source]¶
Load data from file matched with given glob pattern.
Return value will be a list of data unless unite is True. If unite is True, all dataset will be united into a single data.
Parameters: pathname : string
A glob pattern
using : list of integer, slice instance, or None, optional
A list of index or slice instance used to slice data into column If it is not specified, using specified in constructor will be used instead.
unite : boolean, optional:
If it is True then dataset will be united into a single numpy array. See usage for more detail.
basecolumn : integer, optional
An index of base column. all data will be trimmed based on the order of this column when the number of samples are different among the dataset. It only affect when unite is specified as True.
parser : instance, optional
An instance or registered name of parser class. If it is not specified, parser specified in constructor will be used instead.
with_filename : boolean, optional
If it is True, returning dataset will contain filename in the first column. It is cannot be used with unite = True
recursive : boolean, optional
Recursively find pattern in the directory
natsort : boolean
Naturally sort found files.
Returns: ndarray :
A list of numpy array
- load(filename, using=None, parser=None, **kwargs)[source]¶
Load data from file using a specified parser.
Return value will be separated or sliced into a column list
Parameters: filename : string
A data file path
using : list of integer, slice instance, or None, optional
A list of index or slice instance used to slice data into column If it is not specified, using specified in constructor will be used instead.
parser : instance or None, optional
An instance or registered name of parser class. If it is not specified, parser specified in constructor will be used instead.
Returns: ndarray :
A list of numpy array
- maidenhair.loaders.base.slice_columns(x, using=None)[source]¶
Slice a numpy array to make columns
Parameters: x : ndarray
A numpy array instance
using : list of integer or slice instance or None, optional
A list of index or slice instance
Returns: ndarray :
A list of numpy array columns sliced
- maidenhair.loaders.base.unite_dataset(dataset, basecolumn=0)[source]¶
Unite dataset into a single data
Parameters: dataset : list of ndarray
A data list of a column list of a numpy arrays
basecolumn : integer, optional
An index of base column. All data will be trimmed based on the order of this column when the number of samples are different among the dataset
Returns: list of numpy array :
A column list of a numpy array
plain Module¶
A plain text loader
- class maidenhair.loaders.plain.PlainLoader(using=None, parser=None)[source]¶
Bases: maidenhair.loaders.base.BaseLoader
A simple loader class
Methods
glob(pathname[, using, unite, basecolumn, ...]) Load data from file matched with given glob pattern. load(filename[, using, parser]) Load data from file using a specified parser.