本文整理匯總了Python中tools.DHadTable.head方法的典型用法代碼示例。如果您正苦於以下問題:Python DHadTable.head方法的具體用法?Python DHadTable.head怎麽用?Python DHadTable.head使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tools.DHadTable
的用法示例。
在下文中一共展示了DHadTable.head方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: events
# 需要導入模塊: from tools import DHadTable [as 別名]
# 或者: from tools.DHadTable import head [as 別名]
def events(args):
parsed = yld.parse_args(args)
datatype = parsed[0]
tag = parsed[1]
modes = parsed[2]
label_A = parsed[3]
label_B = args[3]
datpath = attr.datpath
tab = DHadTable()
tab.row_append(['Mode', label_A, label_B, 'Common',
'Unique(%s)' %label_A, 'Unique(%s)' %label_B ])
tab.head = tab.data[0]
for mode in modes:
modename = mode.replace('Single_', '')
evtname = datatype + '_' + mode + '.evt'
evtpath_A = os.path.join(datpath, 'evt', label_A, 'events')
evtfile_A = os.path.join(evtpath_A, evtname)
f_A = UserFile(evtfile_A)
events_A = Set(f_A.data)
evtpath_B = os.path.join(datpath, 'evt', label_B, 'events')
evtfile_B = os.path.join(evtpath_B, evtname)
f_B = UserFile(evtfile_B)
events_B = Set(f_B.data)
events_inter = events_A & events_B
entries_A = len(events_A)
entries_B = len(events_B)
common = len(events_inter)
unique_A = len(events_A - events_inter)
unique_B = len(events_B - events_inter)
row = [modename, entries_A, entries_B, common, unique_A, unique_B]
tab.row_append(map(str, row))
tab.output(_tabname)
示例2: entries
# 需要導入模塊: from tools import DHadTable [as 別名]
# 或者: from tools.DHadTable import head [as 別名]
def entries(args):
dt_type = args[0]
tag = args[1]
label_A = args[2]
label_B = args[3]
evtpath = attr.evtpath
rnd='.01'
err_type=None
label = None
diff = 'pct'
tab = DHadTable()
tab.row_append(['Mode', label_A, label_B])
tab.head = tab.data[0]
for mode in attr.modes:
for sign in [1, -1]:
evtfile_A = tools.set_file('evt', dt_type, mode, tag, sign=sign,
prefix='dir_'+label_A, extbase=evtpath)
evtfile_B = tools.set_file('evt', dt_type, mode, tag, sign=sign,
prefix='dir_'+label_B, extbase=evtpath)
entries_A = tools.count_lines(evtfile_A)
entries_B = tools.count_lines(evtfile_B)
if sign == 1:
modename = attr.modes[mode]['fname']
else:
modename = attr.modes[mode]['fnamebar']
row = [modename, entries_A, entries_B]
tab.row_append(map(str, row))
tab.column_append_by_diff_pct('diff(%)', label_B,label_A, rnd=rnd, err_type=err_type)
tab.output(_tabname)