-
源代码
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
6def 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
12def 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内容请搜索靠谱客的其他文章。
发表评论 取消回复