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


Python StringUtils.capitalizeWords方法代码示例

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


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

示例1: getColorNameAndValue

# 需要导入模块: from pyaid.string.StringUtils import StringUtils [as 别名]
# 或者: from pyaid.string.StringUtils.StringUtils import capitalizeWords [as 别名]
    def getColorNameAndValue(self):
        """ Finds the nearest named color by comparing all named colors """
        if self._rawColor == 0:
            return {
                'name':'Black',
                'value':0,
                'key':'black',
                'residual':0.0 }

        maxRange = 560.0
        nearestValue = None
        nearestName  = None
        range   = 360
        myColor = self.asHsl(output=list)
        poolColor = self.__class__(0)
        for name, value in DictUtils.iter(ColorNames.NAMES):
            poolColor.load(value)
            color = poolColor.asHsl(output=list)

            test = (myColor[0] - color[0])*(myColor[0] - color[0]) \
                + (myColor[1] - color[1])*(myColor[1] - color[1]) \
                + (myColor[2] - color[2])*(myColor[2] - color[2])
            if test < range:
                nearestValue = value
                nearestName  = name
                range        = test
            if range < 1:
                break

        return {
            'name':StringUtils.capitalizeWords(nearestName.replace('_', ' ')),
            'value':nearestValue,
            'key':nearestName,
            'residual':100.0*range/maxRange }
开发者ID:sernst,项目名称:PyAid,代码行数:36,代码来源:ColorValue.py

示例2: makeTrackwayBox

# 需要导入模块: from pyaid.string.StringUtils import StringUtils [as 别名]
# 或者: from pyaid.string.StringUtils.StringUtils import capitalizeWords [as 别名]
def makeTrackwayBox(
        site, data, columnName, errorColumnName, trackwayData, **kwargs
):

    label = getColumnLabel(columnName)
    traces = []
    for trackway in data.trackwayName.unique():
        dataSlice = data[data.trackwayName == trackway]
        values = dataSlice[columnName].values
        uncertainties = dataSlice[errorColumnName].values
        name = trackway.split('-')[1:]
        name = '%s:%s (%s) %s-%s' % (
            name[0],
            name[1][-2:],
            name[2],
            name[3],
            name[4])

        try:
            row = trackwayData[trackwayData['Name'] == trackway].iloc[[0]]
        except Exception:
            print('SKIPPED:', trackway, dataSlice.shape[0])
            continue

        traces.append(makeTrackwayWeightedBoxTrace(row, values, uncertainties))
        traces.append(makeTrackwayBoxTrace(row, values))

    if not traces:
        return

    title = StringUtils.capitalizeWords(columnName)

    data = plotlyGraph.Data(traces)
    layout = plotlyGraph.Layout(
        showlegend=False,
        yaxis=plotlyGraph.YAxis(
            title='%s Value' % label),
        xaxis=plotlyGraph.XAxis(
            title='Trackway',
            showticklabels=False ),
        title='%s Trackway "%s" Distributions' % (site, title))

    url = plotly.plot(
        filename='A16/%s-%s-distributions' % (site, label),
        figure_or_data=plotlyGraph.Figure(data=data, layout=layout),
        auto_open=False)
    print('TRACKWAY_BOX[%s]:' % site, url)
开发者ID:sernst,项目名称:Cadence,代码行数:49,代码来源:TrackwayNormalityFigures.py


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