def display(self, config: tp.Optional[DisplayConfig] = None) -> Display: '''Return a Display of the Bus. ''' # NOTE: the key change is providing the Bus as the displayed class config = config or DisplayActive.get() d = Display([], config=config, outermost=True, index_depth=1, header_depth=2) # series and index header display_index = self._index.display(config=config) d.extend_display(display_index) d.extend_display( Display.from_values( self._series.values, # do not force loading with self.values header='', config=config)) display_cls = Display.from_values( (), header=DisplayHeader(self.__class__, self._series._name), config=config) d.insert_displays(display_cls.flatten()) return d
def display(self, config: tp.Optional[DisplayConfig] = None ) -> Display: '''Return a Display of the Series. ''' config = config or DisplayActive.get() d = Display([], config=config, outermost=True, index_depth=1, columns_depth=2) # series and index header display_index = self._index.display(config=config) d.extend_display(display_index) d.extend_display(Display.from_values( self.values, header='', config=config)) display_cls = Display.from_values((), header=DisplayHeader(self.__class__, self._name), config=config) d.insert_displays(display_cls.flatten()) return d
def display(self, config: DisplayConfig=None) -> Display: config = config or DisplayActive.get() if self._recache: self._update_array_cache() # render display rows just of columns sub_config = DisplayConfig(**config.to_dict(type_show=False)) sub_display = None for d in range(self._depth): # as a slice this is far more efficient as no copy is made col = self._labels[:, d] # repeats = col == np.roll(col, 1) # repeats[0] = False # col[repeats] = '.' # TODO: spacer may not be best if sub_display is None: sub_display = Display.from_values(col, header='', config=sub_config) else: sub_display.append_iterable(col, header='') header = '<' + self.__class__.__name__ + '>' return Display.from_values( sub_display.to_rows()[1:-1], # truncate unused header header = header, config=config )
def display(self, config: tp.Optional[DisplayConfig] = None) -> Display: config = config or DisplayActive.get() if self._recache: self._update_array_cache() # render display rows just of columns # sub_config_type = DisplayConfig(**config.to_dict(type_show=False)) # sub_config_no_type = DisplayConfig(**config.to_dict(type_show=False)) sub_config = config sub_display = None for d in range(self._depth): # as a slice this is far more efficient as no copy is made col = self._labels[:, d] # repeats = col == np.roll(col, 1) # repeats[0] = False # col[repeats] = '.' # TODO: spacer may not be best if sub_display is None: # the first sub_display = Display.from_values(col, header=DisplayHeader( self.__class__, self._name), config=sub_config, outermost=True, index_depth=0, columns_depth=1) else: sub_display.extend_iterable(col, header='') return sub_display
def display( self, config: tp.Optional[DisplayConfig] = None, *, style_config: tp.Optional[StyleConfig] = None, ) -> Display: '''{doc} Args: {config} ''' # NOTE: the key change over serires is providing the Bus as the displayed class config = config or DisplayActive.get() display_cls = Display.from_values( (), header=DisplayHeader(self.__class__, self._series._name), config=config) array = np.empty(shape=len(self._index), dtype=DTYPE_OBJECT) # NOTE: do not load FrameDeferred, so concate contained Series's values directly np.concatenate([b._values_mutable for b in self._series.values], out=array) array.flags.writeable = False series = Series(array, index=self._index, own_index=True) return series._display( config, display_cls=display_cls, style_config=style_config, )
def display( self, config: tp.Optional[DisplayConfig] = None, ) -> Display: '''{doc} Args: {config} ''' config = config or DisplayActive.get() if self._recache: self._update_array_cache() header: tp.Optional[DisplayHeader] if config.type_show: header = DisplayHeader(self.__class__, self._name) header_depth = 1 else: header = None header_depth = 0 return Display.from_values( self.values, header=header, config=config, outermost=True, index_depth=0, header_depth=header_depth, )
def display(self, config: DisplayConfig = None) -> Display: config = config or DisplayActive.get() if self._recache: self._update_array_cache() return Display.from_values(self.values, header='<' + self.__class__.__name__ + '>', config=config)
def display(self, config: tp.Optional[DisplayConfig] = None) -> Display: config = config or DisplayActive.get() items = ((label, f.__class__) for label, f in self._items) series = Series.from_items(items, name=self._name) display_cls = Display.from_values( (), header=DisplayHeader(self.__class__, self._name), config=config) return series._display(config, display_cls)
def display(self, config: DisplayConfig = None) -> Display: '''Return a Display of the Series. ''' config = config or DisplayActive.get() d = self._index.display(config=config) d.append_display( Display.from_values(self.values, header='<' + self.__class__.__name__ + '>', config=config)) return d
def display(self, config: tp.Optional[DisplayConfig] = None) -> Display: '''{doc} Args: {config} ''' # NOTE: the key change over serires is providing the Bus as the displayed class config = config or DisplayActive.get() display_cls = Display.from_values( (), header=DisplayHeader(self.__class__, self._series._name), config=config) return self._series._display(config, display_cls)
def display(self, config: tp.Optional[DisplayConfig] = None, ) -> Display: config = config or DisplayActive.get() if self._recache: self._update_array_cache() return Display.from_values(self.values, header=DisplayHeader(self.__class__, self._name), config=config, outermost=True, index_depth=0, columns_depth=1 )
def display(self, config: tp.Optional[DisplayConfig]=None, ) -> Display: # NOTE: deafult index/column is suitable for outermost display. config = config or DisplayActive.get() if self._recache: self._update_array_cache() return Display.from_values(self.values, header=self.__class__, config=config, outermost=True, index_depth=0, columns_depth=1 )
def display(self, config: tp.Optional[DisplayConfig]=None ) -> Display: '''Return a Display of the Series. ''' config = config or DisplayActive.get() d = Display([], config=config, outermost=True, index_depth=1, columns_depth=1) display_index = self._index.display(config=config) d.extend_display(display_index) d.extend_display(Display.from_values( self.values, header=self.__class__, config=config)) return d
def display( self, config: tp.Optional[DisplayConfig] = None, *, style_config: tp.Optional[StyleConfig] = None, ) -> Display: '''Provide a :obj:`Series`-style display of the :obj:`Batch`. Note that if the held iterator is a generator, this display will exhaust the generator. ''' config = config or DisplayActive.get() items = ((label, f.__class__) for label, f in self._items) series = Series.from_items(items, name=self._name) display_cls = Display.from_values( (), header=DisplayHeader(self.__class__, self._name), config=config) return series._display( config, display_cls=display_cls, style_config=style_config, )