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


Python DictSet.unique_combinations方法代码示例

本文整理汇总了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')
开发者ID:flavour,项目名称:cert,代码行数:10,代码来源:test__dictset.py

示例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']])
开发者ID:flavour,项目名称:cert,代码行数:14,代码来源:test__dictset.py

示例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']])
开发者ID:flavour,项目名称:cert,代码行数:14,代码来源:test__dictset.py

示例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']])
开发者ID:flavour,项目名称:cert,代码行数:14,代码来源:test__dictset.py

示例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)
开发者ID:marsja,项目名称:pyvttbl,代码行数:18,代码来源:test_df_insert.py

示例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)
开发者ID:AkulGupta,项目名称:eden,代码行数:38,代码来源:test__pystaggrelite3.py

示例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])
开发者ID:flavour,项目名称:cert,代码行数:7,代码来源:test__dictset.py


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