Total Complexity | 10 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | class Observation(object): |
||
26 | class Sample(object): |
||
27 | observations = None |
||
28 | |||
29 | def __init__(self): |
||
30 | self.observations = [] |
||
31 | |||
32 | def add(self, observation): |
||
33 | self.observations.append(observation) |
||
34 | |||
35 | def size(self): |
||
36 | return len(self.observations) |
||
37 | |||
38 | def get(self, index): |
||
39 | return self.observations[index] |
||
40 | |||
41 | def is_categorical(self): |
||
42 | return self.observations[0].is_categorical() |
||
43 | |||
44 | def is_numerical(self): |
||
45 | return self.observations[0].is_numerical() |
||
46 | |||
47 | def count_by_group_id(self, group_id): |
||
48 | return sum(1 for x in self.observations if group_id is None or x.group_id == group_id) |
||
49 | |||
73 |