def __len__(self): if self.data: return {k: len(v) for k, v in self.data.items()} if is_dict__( self.data) else len(self.data) else: return 0
def __len__(self): if self.indices: return {k: self._len(v) for k, v in self.indices.items()} if is_dict__( self.indices) else self._len(self.indices) else: raise RuntimeError( 'index the data first; otherwise the length is not available')
def _index(self, indexer: IndexDict): first = indexer.index_all(self.data[0]) if is_dict__(first): return sum((indexer.index_all(x) for x in self.data[1:]), first) else: return [first] + [indexer.index_all(x) for x in self.data[1:]]
def _index(self, indexer): indices = [indexer.index(x) for x in self.data] return sum(indices, ListDict()) if is_dict__(indices[0]) else indices