Python pandas.core.common._any_not_none() Examples
The following are 30
code examples of pandas.core.common._any_not_none().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.core.common
, or try the search function
.
Example #1
Source File: api.py From recruit with Apache License 2.0 | 6 votes |
def _get_consensus_names(indexes): """ Give a consensus 'names' to indexes. If there's exactly one non-empty 'names', return this, otherwise, return empty. Parameters ---------- indexes : list of Index objects Returns ------- list A list representing the consensus 'names' found. """ # find the non-none names, need to tupleify to make # the set hashable, then reverse on return consensus_names = {tuple(i.names) for i in indexes if com._any_not_none(*i.names)} if len(consensus_names) == 1: return list(list(consensus_names)[0]) return [None] * indexes[0].nlevels
Example #2
Source File: multi.py From recruit with Apache License 2.0 | 6 votes |
def _format_attrs(self): """ Return a list of tuples of the (attr,formatted_value) """ attrs = [ ('levels', ibase.default_pprint(self._levels, max_seq_items=False)), ('codes', ibase.default_pprint(self._codes, max_seq_items=False))] if com._any_not_none(*self.names): attrs.append(('names', ibase.default_pprint(self.names))) if self.sortorder is not None: attrs.append(('sortorder', ibase.default_pprint(self.sortorder))) return attrs
Example #3
Source File: api.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def _get_consensus_names(indexes): """ Give a consensus 'names' to indexes. If there's exactly one non-empty 'names', return this, otherwise, return empty. Parameters ---------- indexes : list of Index objects Returns ------- list A list representing the consensus 'names' found. """ # find the non-none names, need to tupleify to make # the set hashable, then reverse on return consensus_names = {tuple(i.names) for i in indexes if com._any_not_none(*i.names)} if len(consensus_names) == 1: return list(list(consensus_names)[0]) return [None] * indexes[0].nlevels
Example #4
Source File: api.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def _get_consensus_names(indexes): # find the non-none names, need to tupleify to make # the set hashable, then reverse on return consensus_names = set([tuple(i.names) for i in indexes if com._any_not_none(*i.names)]) if len(consensus_names) == 1: return list(list(consensus_names)[0]) return [None] * indexes[0].nlevels
Example #5
Source File: _core.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, MultiIndex): name = self.data.index.names if _any_not_none(*name): name = ','.join([pprint_thing(x) for x in name]) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #6
Source File: _core.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _make_plot(self): if self._is_ts_plot(): from pandas.plotting._timeseries import _maybe_convert_index data = _maybe_convert_index(self._get_ax(0), self.data) x = data.index # dummy, not used plotf = self._ts_plot it = self._iter_data(data=data, keep_index=True) else: x = self._get_xticks(convert_period=True) plotf = self._plot it = self._iter_data() stacking_id = self._get_stacking_id() is_errorbar = _any_not_none(*self.errors.values()) colors = self._get_colors() for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() style, kwds = self._apply_style_colors(colors, kwds, i, label) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) label = pprint_thing(label) # .encode('utf-8') kwds['label'] = label newlines = plotf(ax, x, y, style=style, column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, **kwds) self._add_legend_handle(newlines[0], label, index=i) if not _mpl_ge_2_0_0(): lines = _get_all_lines(ax) left, right = _get_xlim(lines) ax.set_xlim(left, right)
Example #7
Source File: api.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _get_consensus_names(indexes): # find the non-none names, need to tupleify to make # the set hashable, then reverse on return consensus_names = set([tuple(i.names) for i in indexes if com._any_not_none(*i.names)]) if len(consensus_names) == 1: return list(list(consensus_names)[0]) return [None] * indexes[0].nlevels
Example #8
Source File: merge.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _any(x): return x is not None and com._any_not_none(*x)
Example #9
Source File: format.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _has_names(index): if isinstance(index, MultiIndex): return _any_not_none(*index.names) else: return index.name is not None
Example #10
Source File: _core.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, MultiIndex): name = self.data.index.names if _any_not_none(*name): name = ','.join([pprint_thing(x) for x in name]) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #11
Source File: _core.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def _make_plot(self): if self._is_ts_plot(): from pandas.plotting._timeseries import _maybe_convert_index data = _maybe_convert_index(self._get_ax(0), self.data) x = data.index # dummy, not used plotf = self._ts_plot it = self._iter_data(data=data, keep_index=True) else: x = self._get_xticks(convert_period=True) plotf = self._plot it = self._iter_data() stacking_id = self._get_stacking_id() is_errorbar = _any_not_none(*self.errors.values()) colors = self._get_colors() for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() style, kwds = self._apply_style_colors(colors, kwds, i, label) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) label = pprint_thing(label) # .encode('utf-8') kwds['label'] = label newlines = plotf(ax, x, y, style=style, column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, **kwds) self._add_legend_handle(newlines[0], label, index=i) if not _mpl_ge_2_0_0(): lines = _get_all_lines(ax) left, right = _get_xlim(lines) ax.set_xlim(left, right)
Example #12
Source File: merge.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _any(x): return x is not None and com._any_not_none(*x)
Example #13
Source File: merge.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def _any(x): return x is not None and com._any_not_none(*x)
Example #14
Source File: format.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def _has_names(index): if isinstance(index, MultiIndex): return _any_not_none(*index.names) else: return index.name is not None
Example #15
Source File: _core.py From coffeegrindsize with MIT License | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, ABCMultiIndex): name = self.data.index.names if com._any_not_none(*name): name = ','.join(pprint_thing(x) for x in name) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #16
Source File: _core.py From coffeegrindsize with MIT License | 5 votes |
def _make_plot(self): if self._is_ts_plot(): from pandas.plotting._timeseries import _maybe_convert_index data = _maybe_convert_index(self._get_ax(0), self.data) x = data.index # dummy, not used plotf = self._ts_plot it = self._iter_data(data=data, keep_index=True) else: x = self._get_xticks(convert_period=True) plotf = self._plot it = self._iter_data() stacking_id = self._get_stacking_id() is_errorbar = com._any_not_none(*self.errors.values()) colors = self._get_colors() for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() style, kwds = self._apply_style_colors(colors, kwds, i, label) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) label = pprint_thing(label) # .encode('utf-8') kwds['label'] = label newlines = plotf(ax, x, y, style=style, column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, **kwds) self._add_legend_handle(newlines[0], label, index=i) lines = _get_all_lines(ax) left, right = _get_xlim(lines) ax.set_xlim(left, right)
Example #17
Source File: _core.py From twitter-stock-recommendation with MIT License | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, MultiIndex): name = self.data.index.names if com._any_not_none(*name): name = ','.join(pprint_thing(x) for x in name) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #18
Source File: _core.py From twitter-stock-recommendation with MIT License | 5 votes |
def _make_plot(self): if self._is_ts_plot(): from pandas.plotting._timeseries import _maybe_convert_index data = _maybe_convert_index(self._get_ax(0), self.data) x = data.index # dummy, not used plotf = self._ts_plot it = self._iter_data(data=data, keep_index=True) else: x = self._get_xticks(convert_period=True) plotf = self._plot it = self._iter_data() stacking_id = self._get_stacking_id() is_errorbar = com._any_not_none(*self.errors.values()) colors = self._get_colors() for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() style, kwds = self._apply_style_colors(colors, kwds, i, label) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) label = pprint_thing(label) # .encode('utf-8') kwds['label'] = label newlines = plotf(ax, x, y, style=style, column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, **kwds) self._add_legend_handle(newlines[0], label, index=i) if not _mpl_ge_2_0_0(): lines = _get_all_lines(ax) left, right = _get_xlim(lines) ax.set_xlim(left, right)
Example #19
Source File: format.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _has_names(index): if isinstance(index, ABCMultiIndex): return com._any_not_none(*index.names) else: return index.name is not None
Example #20
Source File: _core.py From recruit with Apache License 2.0 | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, ABCMultiIndex): name = self.data.index.names if com._any_not_none(*name): name = ','.join(pprint_thing(x) for x in name) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #21
Source File: multi.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _format_attrs(self): """ Return a list of tuples of the (attr,formatted_value) """ attrs = [ ('levels', ibase.default_pprint(self._levels, max_seq_items=False)), ('codes', ibase.default_pprint(self._codes, max_seq_items=False))] if com._any_not_none(*self.names): attrs.append(('names', ibase.default_pprint(self.names))) if self.sortorder is not None: attrs.append(('sortorder', ibase.default_pprint(self.sortorder))) return attrs
Example #22
Source File: _core.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _make_plot(self): if self._is_ts_plot(): from pandas.plotting._timeseries import _maybe_convert_index data = _maybe_convert_index(self._get_ax(0), self.data) x = data.index # dummy, not used plotf = self._ts_plot it = self._iter_data(data=data, keep_index=True) else: x = self._get_xticks(convert_period=True) plotf = self._plot it = self._iter_data() stacking_id = self._get_stacking_id() is_errorbar = com._any_not_none(*self.errors.values()) colors = self._get_colors() for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() style, kwds = self._apply_style_colors(colors, kwds, i, label) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) label = pprint_thing(label) # .encode('utf-8') kwds['label'] = label newlines = plotf(ax, x, y, style=style, column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, **kwds) self._add_legend_handle(newlines[0], label, index=i) lines = _get_all_lines(ax) left, right = _get_xlim(lines) ax.set_xlim(left, right)
Example #23
Source File: _core.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, ABCMultiIndex): name = self.data.index.names if com._any_not_none(*name): name = ','.join(pprint_thing(x) for x in name) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #24
Source File: format.py From vnpy_crypto with MIT License | 5 votes |
def _has_names(index): if isinstance(index, MultiIndex): return com._any_not_none(*index.names) else: return index.name is not None
Example #25
Source File: merge.py From vnpy_crypto with MIT License | 5 votes |
def _any(x): return x is not None and com._any_not_none(*x)
Example #26
Source File: multi.py From vnpy_crypto with MIT License | 5 votes |
def _format_attrs(self): """ Return a list of tuples of the (attr,formatted_value) """ attrs = [ ('levels', ibase.default_pprint(self._levels, max_seq_items=False)), ('labels', ibase.default_pprint(self._labels, max_seq_items=False))] if com._any_not_none(*self.names): attrs.append(('names', ibase.default_pprint(self.names))) if self.sortorder is not None: attrs.append(('sortorder', ibase.default_pprint(self.sortorder))) return attrs
Example #27
Source File: api.py From vnpy_crypto with MIT License | 5 votes |
def _get_consensus_names(indexes): # find the non-none names, need to tupleify to make # the set hashable, then reverse on return consensus_names = set(tuple(i.names) for i in indexes if com._any_not_none(*i.names)) if len(consensus_names) == 1: return list(list(consensus_names)[0]) return [None] * indexes[0].nlevels
Example #28
Source File: _core.py From vnpy_crypto with MIT License | 5 votes |
def _make_plot(self): if self._is_ts_plot(): from pandas.plotting._timeseries import _maybe_convert_index data = _maybe_convert_index(self._get_ax(0), self.data) x = data.index # dummy, not used plotf = self._ts_plot it = self._iter_data(data=data, keep_index=True) else: x = self._get_xticks(convert_period=True) plotf = self._plot it = self._iter_data() stacking_id = self._get_stacking_id() is_errorbar = com._any_not_none(*self.errors.values()) colors = self._get_colors() for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() style, kwds = self._apply_style_colors(colors, kwds, i, label) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) label = pprint_thing(label) # .encode('utf-8') kwds['label'] = label newlines = plotf(ax, x, y, style=style, column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, **kwds) self._add_legend_handle(newlines[0], label, index=i) if not _mpl_ge_2_0_0(): lines = _get_all_lines(ax) left, right = _get_xlim(lines) ax.set_xlim(left, right)
Example #29
Source File: _core.py From vnpy_crypto with MIT License | 5 votes |
def _get_index_name(self): if isinstance(self.data.index, MultiIndex): name = self.data.index.names if com._any_not_none(*name): name = ','.join(pprint_thing(x) for x in name) else: name = None else: name = self.data.index.name if name is not None: name = pprint_thing(name) return name
Example #30
Source File: format.py From recruit with Apache License 2.0 | 5 votes |
def _has_names(index): if isinstance(index, ABCMultiIndex): return com._any_not_none(*index.names) else: return index.name is not None