本文整理汇总了Python中dictset.DictSet.unique_combinations方法的典型用法代码示例。如果您正苦于以下问题:Python DictSet.unique_combinations方法的具体用法?Python DictSet.unique_combinations怎么用?Python DictSet.unique_combinations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dictset.DictSet
的用法示例。
在下文中一共展示了DictSet.unique_combinations方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test4
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test4(self):
L = DictSet(s2d('a12 c568 d123 e78'))
g=L.unique_combinations()
self.assertEqual(''.join([''.join(v) for v in g]),
'151715181527152815371538161716181627162816371638'
'181718181827182818371838251725182527252825372538'
'261726182627262826372638281728182827282828372838')
示例2: test3
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test3(self):
L = DictSet(s2d('a12 c5666788 d12345'))
g=L.unique_combinations(keys=['c','a'])
self.assertEqual([v for v in g],[['5','1'],
['5','2'],
['6','1'],
['6','2'],
['7','1'],
['7','2'],
['8','1'],
['8','2']])
示例3: test2
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test2(self):
L = DictSet(s2d('a12 c5666788 d12345'))
g=L.unique_combinations(keys=['a','c'])
self.assertEqual([v for v in g],[['1','5'],
['1','6'],
['1','7'],
['1','8'],
['2','5'],
['2','6'],
['2','7'],
['2','8']])
示例4: test1
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test1(self):
L = DictSet(s2d('a12 c5666788 d0'))
g=L.unique_combinations()
self.assertEqual([v for v in g],[['1','5'],
['1','6'],
['1','7'],
['1','8'],
['2','5'],
['2','6'],
['2','7'],
['2','8']])
示例5: test0
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test0(self):
df=DataFrame()
conditionsDict=DictSet({'A':[10,20,40,80],
'B':[100,800],
'rep':range(10)})
for A,B,rep in conditionsDict.unique_combinations():
df.insert({'A':A, 'B':B,'rep':rep})
for d,r in zip(df['A'],_rep_generator([10,20,40,80],4,20)):
self.assertAlmostEqual(d,r)
for d,r in zip(df['B'],_rep_generator([100,800],8,10)):
self.assertAlmostEqual(d,r)
for d,r in zip(df['rep'],_rep_generator(range(10),8,1)):
self.assertAlmostEqual(d,r)
示例6: test
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test(self):
# build the test data
V=[]
for i in range(300):
V.append(normalvariate(100.,10.))
# build some weight vectors to test
W1=[.001 for i in range(300)]
W2=[1. for i in range(300)]
W2[0]=10000.
W3=[-1. for i in range(300)]
W=[W1, W2, W3, None]
# factorially examine the conditions in this DictSet
# see: http://code.google.com/p/dictset/
ds = DictSet({'bins':[1,2,10,171,500],
'range':[(0,100),None],
'density':[True, False],
'weights':[0, 1, 2, 3],
'cumulative':[True, False]})
for b,r,d,w,c in ds.unique_combinations(
['bins','range','density','weights','cumulative']):
print(b,r,d,w,c)
DN, DB = pystaggrelite3.hist(V, b, r, d, W[w], c)
pylab.figure()
RN, RB, patches = pylab.hist(V, b, r, d, W[w], c)
pylab.close()
for d,r in zip(DN, RN):
self.assertAlmostEqual(d, r)
for d,r in zip(DB, RB):
self.assertAlmostEqual(d, r)
示例7: test0
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import unique_combinations [as 别名]
def test0(self):
L = DictSet(s2d('a1 c5666788 d0'))
g=L.unique_combinations(keys=[])
self.assertEqual([v for v in g],[None])