-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Philippe THOMY edited this page Aug 2, 2022
·
8 revisions
The Ilist Object (Indexed List) is a combination of a list of values (indexed values) and a list of properties (index) that describe it.
For example, csv file, log, measurement are indexed lists.
Note : indexed values and index values can be every kind of object (not only textual or numerical).
In the example below, the set of data is scores of students and the properties are the name, the age and the subject.
The Ilist Object has many properties and can be converted into a matrix (e.g. Xarray object to perform statistical processing) or into several formats (e.g. json, csv, bytes).
In [21]: example = Ilist.Iedic({'score' : [10, 12, 15]},
...: {'name' : ['paul', 'lea', 'lea'],
...: 'age' : [16, 15, 15],
...: 'subject' : ['math', 'math', 'english']})
In [22]: example.to_xarray(fillvalue=math.nan)
Out[22]:
<xarray.DataArray 'Ilist' (name: 2, subject: 2)>
array([[15., 12.],
[nan, 10.]])
Coordinates:
* name (name) <U4 'lea' 'paul'
age (name) int32 15 16
* subject (subject) <U7 'english' 'math'
In [23]: example.json()
Out[23]:
{'order': ['name', 'age', 'subject'],
'name': ['paul', 'lea'],
'age': [16, 15],
'subject': ['math', 'english'],
'score': [10, 12, 15],
'index': [[0, 1, 1], [0, 1, 1], [0, 0, 1]]}
The Ilist data model includes two levels :
- external level (user data)
- internal level (key data)