| 1005 | |
| 1006 | |
| 1007 | class hvDataFrameExplorer(hvPlotExplorer): |
| 1008 | z = param.Selector() |
| 1009 | |
| 1010 | kind = param.Selector(default='scatter', objects=KINDS['all']) |
| 1011 | |
| 1012 | @property |
| 1013 | def _var_name(self): |
| 1014 | return 'df' |
| 1015 | |
| 1016 | @property |
| 1017 | def xcat(self): |
| 1018 | if self.kind in ('bar', 'box', 'violin'): |
| 1019 | return False |
| 1020 | values = self._data[self.x] |
| 1021 | return values.dtype.kind in 'OSU' |
| 1022 | |
| 1023 | @property |
| 1024 | def _x(self): |
| 1025 | return (self._converter.x or self._converter.variables[0]) if self.x is None else self.x |
| 1026 | |
| 1027 | @property |
| 1028 | def _y(self): |
| 1029 | if 'y_multi' in self._controls.parameters and self.y_multi: |
| 1030 | y = self.y_multi |
| 1031 | elif 'y_multi' not in self._controls.parameters and self.y: |
| 1032 | y = self.y |
| 1033 | else: |
| 1034 | y = self._converter._process_chart_y(self._data, self._x, None, self._single_y) |
| 1035 | if isinstance(y, list) and len(y) == 1: |
| 1036 | y = y[0] |
| 1037 | return y |
| 1038 | |
| 1039 | @property |
| 1040 | def _groups(self): |
| 1041 | return ['dataframe'] |
| 1042 | |
| 1043 | @param.depends('x') |
| 1044 | def xlim(self): |
| 1045 | if self._x == 'index': |
| 1046 | values = self._data.index.values |
| 1047 | else: |
| 1048 | try: |
| 1049 | values = self._data[self._x] |
| 1050 | except Exception: |
| 1051 | return 0, 1 |
| 1052 | # for dask series; else it cannot get length |
| 1053 | if hasattr(values, 'compute_chunk_sizes'): |
| 1054 | values = values.compute_chunk_sizes() |
| 1055 | if values.dtype.kind in 'OSU': |
| 1056 | return None |
| 1057 | elif not len(values): |
| 1058 | return (np.nan, np.nan) |
| 1059 | return (np.nanmin(values), np.nanmax(values)) |
| 1060 | |
| 1061 | @param.depends('y', 'y_multi') |
| 1062 | def ylim(self): |
| 1063 | y = self._y |
| 1064 | if not isinstance(y, list): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…