本文整理汇总了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 }
示例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)