我是靠谱客的博主 传统嚓茶,这篇文章主要介绍理解common.count_not_none()||dedent||zsqrt,现在分享给大家,希望可以做个参考。

  • 源代码

    From ExponentialMovingWindow:

    复制代码
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    _agg_see_also_doc = dedent( """ See Also -------- pandas.DataFrame.rolling.aggregate """ ) @doc( _shared_docs["aggregate"], see_also=_agg_see_also_doc, examples=_agg_examples_doc, versionadded="", klass="Series/Dataframe", axis="", ) def std(): return zsqrt(...)
  • common

    pandas/core/common.py

    复制代码
    1
    2
    3
    4
    5
    6
    def count_not_none(*args) -> int: """ Returns the count of arguments that are not None """ return sum(x is not None for x in args)

    From official API reference, cann’t find an explaination about the module of common.py. I think it is commonly used by the core develop, but it is really usefull.

    Just like the header explaination :

    复制代码
    1
    2
    3
    4
    5
    """ Misc tools for implementing data structures Note : pandas.core.common is 'not' part of the public API """

    pandas/core/window/common.py

    It is common utility functions for rolling oprations.

    复制代码
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    def zsqrt(x): with np.errstate(all="ignore"): result = np.sqrt(x) mask = x < 0 if isinstance(x, ABCDataFrame): if mask._values.any(): result[mask] = 0 else: if mask.any(): result[mask] = 0 return result
  • From textwrap import dedent

    textwrap.py module provides some convenience functions, as well as TextWrapper, the class that does all the work.

    textwrap.dedent(text)

    Remove any common leanding whitespace from every line in text.

    This can be used to make triple-quoted string line up with the left edge of the display, while still presenting them in the source code in indented form

  • from pandas.util._decorators import Appender, Substitution,

最后

以上就是传统嚓茶最近收集整理的关于理解common.count_not_none()||dedent||zsqrt的全部内容,更多相关理解common内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部