Biogeme: Python Library  2.5
Public Member Functions | Public Attributes | List of all members
bio_iterator.metaIterator Class Reference

meta iterators are designed to iterate on group of rows of the data file. More...

Inheritance diagram for bio_iterator.metaIterator:
bio_iterator.iterator

Public Member Functions

def __init__ (self, iteratorName, name, child, variable)
 
- Public Member Functions inherited from bio_iterator.iterator
def __init__ (self, iteratorName, name, child, variable)
 
def __str__ (self)
 

Public Attributes

 type
 
- Public Attributes inherited from bio_iterator.iterator
 iteratorName
 
 name
 
 child
 
 variable
 

Detailed Description

meta iterators are designed to iterate on group of rows of the data file.

They are typically used for panel data, where several rows correspond to the same individual. In the example represented in the table below, the meta iterator will identify 4 groups of data: rows 1 to 4, rows 5 to 7, rows 8 to 9 and rows 10 to 11. Note that group 1 and group 4 share the same Id. But the iterator does not take this into account, as only changes of the value of the identifier characterize a change of group. If rows 10 and 11 indeed belong to group 1, the data file must be edited so that they appear directly after row 4.

1 __rowId__ Id ObsId Variables
2  1 1 1 ...
3  2 1 2 ...
4  3 1 3 ...
5  4 1 4 ...
6  5 2 1 ...
7  6 2 2 ...
8  7 2 3 ...
9  8 3 1 ...
10  9 3 2 ...
11  10 1 5 ...
12  11 1 6 ...

An example of iterator on this data is

1 metaIterator('personIter','__dataFile__','panelObsIter','Id')
2 rowIterator('panelObsIter','personIter')

Definition at line 76 of file bio_iterator.py.

Constructor & Destructor Documentation

def bio_iterator.metaIterator.__init__ (   self,
  iteratorName,
  name,
  child,
  variable 
)
Parameters
iteratorNameName of the iterator.
nameName of the set of data that is being iterated. It is either the name of a metaiterator, or the string dataFile, when the iterator spans the entire database.
childName of the child
variableVariable that contains the ID of the elements being iterated.

Definition at line 81 of file bio_iterator.py.


The documentation for this class was generated from the following file:
Copyright 2016 Michel Bierlaire