当前位置: 首页>>代码示例>>Python>>正文


Python common.is_float方法代码示例

本文整理汇总了Python中pandas.core.dtypes.common.is_float方法的典型用法代码示例。如果您正苦于以下问题:Python common.is_float方法的具体用法?Python common.is_float怎么用?Python common.is_float使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandas.core.dtypes.common的用法示例。


在下文中一共展示了common.is_float方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _format_value

# 需要导入模块: from pandas.core.dtypes import common [as 别名]
# 或者: from pandas.core.dtypes.common import is_float [as 别名]
def _format_value(self, val):
        if is_scalar(val) and missing.isna(val):
            val = self.na_rep
        elif is_float(val):
            if missing.isposinf_scalar(val):
                val = self.inf_rep
            elif missing.isneginf_scalar(val):
                val = '-{inf}'.format(inf=self.inf_rep)
            elif self.float_format is not None:
                val = float(self.float_format % val)
        return val 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:excel.py

示例2: __init__

# 需要导入模块: from pandas.core.dtypes import common [as 别名]
# 或者: from pandas.core.dtypes.common import is_float [as 别名]
def __init__(self, data, precision=None, table_styles=None, uuid=None,
                 caption=None, table_attributes=None, cell_ids=True):
        self.ctx = defaultdict(list)
        self._todo = []

        if not isinstance(data, (pd.Series, pd.DataFrame)):
            raise TypeError("``data`` must be a Series or DataFrame")
        if data.ndim == 1:
            data = data.to_frame()
        if not data.index.is_unique or not data.columns.is_unique:
            raise ValueError("style is not supported for non-unique indices.")

        self.data = data
        self.index = data.index
        self.columns = data.columns

        self.uuid = uuid
        self.table_styles = table_styles
        self.caption = caption
        if precision is None:
            precision = get_option('display.precision')
        self.precision = precision
        self.table_attributes = table_attributes
        self.hidden_index = False
        self.hidden_columns = []
        self.cell_ids = cell_ids

        # display_funcs maps (row, col) -> formatting function

        def default_display_func(x):
            if is_float(x):
                return '{:>.{precision}g}'.format(x, precision=self.precision)
            else:
                return x

        self._display_funcs = defaultdict(lambda: default_display_func) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:38,代码来源:style.py

示例3: __init__

# 需要导入模块: from pandas.core.dtypes import common [as 别名]
# 或者: from pandas.core.dtypes.common import is_float [as 别名]
def __init__(self, data, precision=None, table_styles=None, uuid=None,
                 caption=None, table_attributes=None):
        self.ctx = defaultdict(list)
        self._todo = []

        if not isinstance(data, (pd.Series, pd.DataFrame)):
            raise TypeError("``data`` must be a Series or DataFrame")
        if data.ndim == 1:
            data = data.to_frame()
        if not data.index.is_unique or not data.columns.is_unique:
            raise ValueError("style is not supported for non-unique indicies.")

        self.data = data
        self.index = data.index
        self.columns = data.columns

        self.uuid = uuid
        self.table_styles = table_styles
        self.caption = caption
        if precision is None:
            precision = get_option('display.precision')
        self.precision = precision
        self.table_attributes = table_attributes
        self.hidden_index = False
        self.hidden_columns = []

        # display_funcs maps (row, col) -> formatting function

        def default_display_func(x):
            if is_float(x):
                return '{:>.{precision}g}'.format(x, precision=self.precision)
            else:
                return x

        self._display_funcs = defaultdict(lambda: default_display_func) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:37,代码来源:style.py

示例4: _format_value

# 需要导入模块: from pandas.core.dtypes import common [as 别名]
# 或者: from pandas.core.dtypes.common import is_float [as 别名]
def _format_value(self, val):
        if lib.checknull(val):
            val = self.na_rep
        elif is_float(val):
            if lib.isposinf_scalar(val):
                val = self.inf_rep
            elif lib.isneginf_scalar(val):
                val = '-{inf}'.format(inf=self.inf_rep)
            elif self.float_format is not None:
                val = float(self.float_format % val)
        return val 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:13,代码来源:excel.py

示例5: __init__

# 需要导入模块: from pandas.core.dtypes import common [as 别名]
# 或者: from pandas.core.dtypes.common import is_float [as 别名]
def __init__(self, data, precision=None, table_styles=None, uuid=None,
                 caption=None, table_attributes=None):
        self.ctx = defaultdict(list)
        self._todo = []

        if not isinstance(data, (pd.Series, pd.DataFrame)):
            raise TypeError("``data`` must be a Series or DataFrame")
        if data.ndim == 1:
            data = data.to_frame()
        if not data.index.is_unique or not data.columns.is_unique:
            raise ValueError("style is not supported for non-unique indicies.")

        self.data = data
        self.index = data.index
        self.columns = data.columns

        self.uuid = uuid
        self.table_styles = table_styles
        self.caption = caption
        if precision is None:
            precision = get_option('display.precision')
        self.precision = precision
        self.table_attributes = table_attributes
        # display_funcs maps (row, col) -> formatting function

        def default_display_func(x):
            if is_float(x):
                return '{:>.{precision}g}'.format(x, precision=self.precision)
            else:
                return x

        self._display_funcs = defaultdict(lambda: default_display_func) 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:34,代码来源:style.py


注:本文中的pandas.core.dtypes.common.is_float方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。