當前位置: 首頁>>代碼示例>>Python>>正文


Python common._any_not_none方法代碼示例

本文整理匯總了Python中pandas.core.common._any_not_none方法的典型用法代碼示例。如果您正苦於以下問題:Python common._any_not_none方法的具體用法?Python common._any_not_none怎麽用?Python common._any_not_none使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.core.common的用法示例。


在下文中一共展示了common._any_not_none方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_consensus_names

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:26,代碼來源:api.py

示例2: _get_index_name

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:15,代碼來源:_core.py

示例3: _make_plot

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:39,代碼來源:_core.py

示例4: _format_attrs

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:16,代碼來源:multi.py

示例5: _any

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
def _any(x):
    return x is not None and com._any_not_none(*x) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:4,代碼來源:merge.py

示例6: _has_names

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
def _has_names(index):
    if isinstance(index, ABCMultiIndex):
        return com._any_not_none(*index.names)
    else:
        return index.name is not None 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:7,代碼來源:format.py

示例7: _get_index_name

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:15,代碼來源:_core.py

示例8: _make_plot

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:40,代碼來源:_core.py

示例9: _get_consensus_names

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:11,代碼來源:api.py

示例10: _format_attrs

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:16,代碼來源:multi.py

示例11: _has_names

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
def _has_names(index):
    if isinstance(index, MultiIndex):
        return com._any_not_none(*index.names)
    else:
        return index.name is not None 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:7,代碼來源:format.py

示例12: _get_index_name

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:15,代碼來源:_core.py

示例13: _make_plot

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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) 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:40,代碼來源:_core.py

示例14: _get_consensus_names

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
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 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:11,代碼來源:api.py

示例15: _has_names

# 需要導入模塊: from pandas.core import common [as 別名]
# 或者: from pandas.core.common import _any_not_none [as 別名]
def _has_names(index):
    if isinstance(index, MultiIndex):
        return _any_not_none(*index.names)
    else:
        return index.name is not None 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:7,代碼來源:format.py


注:本文中的pandas.core.common._any_not_none方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。