| Total Complexity | 8 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from green_magic.data.interfaces import TabularRetriever, TabularIterator |
||
| 2 | |||
| 3 | |||
| 4 | class PDTabularRetriever(TabularRetriever): |
||
| 5 | """The observation object is the same as the one your return from 'from_json_lines'""" |
||
| 6 | def column(self, identifier, data): |
||
| 7 | return data.observations[identifier] |
||
| 8 | |||
| 9 | def row(self, identifier, data): |
||
| 10 | return data.observations.loc(identifier) |
||
| 11 | |||
| 12 | def nb_columns(self, data): |
||
| 13 | return len(data.observations.columns) |
||
| 14 | |||
| 15 | def nb_rows(self, data): |
||
| 16 | return len(data.observations) |
||
| 17 | |||
| 18 | def get_numerical_attributes(self, data): |
||
| 19 | return data.observations._get_numeric_data().columns.values |
||
| 20 | |||
| 21 | class PDTabularIterator(TabularIterator): |
||
| 22 | """The observation object is the same as the one your return from 'from_json_lines'""" |
||
| 23 | |||
| 24 | def columnnames(self, data): |
||
| 25 | return [_ for _ in data.observations.columns] |
||
| 26 | |||
| 27 | def iterrows(self, data): |
||
| 28 | return iter(data.observations.iterrows()) |
||
| 29 | |||
| 30 | def itercolumns(self, data): |
||
| 31 | return iter(data.observations[column] for column in data.observations.columns) |
||
| 32 |