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


Python offset.FilterByOffsetIndexer类代码示例

本文整理汇总了Python中vis.analyzers.indexers.offset.FilterByOffsetIndexer的典型用法代码示例。如果您正苦于以下问题:Python FilterByOffsetIndexer类的具体用法?Python FilterByOffsetIndexer怎么用?Python FilterByOffsetIndexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_offset_xparts_2

 def test_offset_xparts_2(self):
     # input is expected output; 10 parts
     in_val = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
               pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5])]
     expected = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5]),
                 pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5])]
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
     for i in xrange(len(expected)):
         self.assertEqual(len(expected[i]), len(actual[i]))  # same number of rows?
         self.assertEqual(list(expected[i].index), list(actual[i].index))  # same row names?
开发者ID:willingc,项目名称:vis,代码行数:29,代码来源:test_offset.py

示例2: test_run_2

 def test_run_2(self):
     # ensure that run() properly gets "method" from self._settings (default value)
     in_val = [mock.MagicMock(spec_set=pandas.Series)]
     in_val[0].index = [0.0]
     settings = {'quarterLength': 0.5}
     ind = FilterByOffsetIndexer(in_val, settings)
     ind.run()
     in_val[0].reindex.assert_called_once_with(index=[0.0], method='ffill')
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:8,代码来源:test_offset.py

示例3: test_offset_1part_0

 def test_offset_1part_0(self):
     # 0 parts
     in_val = []
     expected = []
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
开发者ID:willingc,项目名称:vis,代码行数:8,代码来源:test_offset.py

示例4: test_offset_1part_9

 def test_offset_1part_9(self):
     #  targeted test for end-of-piece: when last thing lands on an observed offset
     in_val = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.4, 1.1, 2.0])]
     expected = pandas.Series(['a', 'b', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5, 2.0])
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(1, len(actual.columns))  # same number of columns?
     actual = actual['0']
     self.assertSequenceEqual(list(expected.values), list(actual.values))  # same rows?
     self.assertSequenceEqual(list(expected.index), list(actual.index))  # same index?
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:11,代码来源:test_offset.py

示例5: test_offset_1part_7

 def test_offset_1part_7(self):
     # irregular offset interval to a large one
     in_val = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.4, 1.1, 2.1])]
     expected = pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 1.0, 2.0, 3.0])
     offset_interval = 1.0
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(1, len(actual.columns))  # same number of columns?
     actual = actual['0']
     self.assertSequenceEqual(list(expected.values), list(actual.values))  # same rows?
     self.assertSequenceEqual(list(expected.index), list(actual.index))  # same index?
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:11,代码来源:test_offset.py

示例6: test_offset_1part_5

 def test_offset_1part_5(self):
     # already regular offset interval (but some missing) to larger one
     in_val = [pandas.Series(['a', 'b', 'c'], index=[0.0, 0.5, 1.5])]
     expected = pandas.Series(['a', 'b', 'c'], index=[0.0, 1.0, 2.0])
     offset_interval = 1.0
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(1, len(actual.columns))  # same number of columns?
     actual = actual['0']
     self.assertSequenceEqual(list(expected.values), list(actual.values))  # same rows?
     self.assertSequenceEqual(list(expected.index), list(actual.index))  # same index?
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:11,代码来源:test_offset.py

示例7: test_offset_1part_4b

 def test_offset_1part_4b(self):
     # already regular offset interval to a very small one
     in_val = [pandas.Series(['a', 'b'], index=[0.0, 0.5])]
     expected = pandas.Series(['a', 'a', 'a', 'a', 'b'], index=[0.0, 0.125, 0.25, 0.375, 0.5])
     offset_interval = 0.125
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(1, len(actual.columns))  # same number of columns?
     actual = actual['0']
     self.assertSequenceEqual(list(expected.values), list(actual.values))  # same rows?
     self.assertSequenceEqual(list(expected.index), list(actual.index))  # same index?
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:11,代码来源:test_offset.py

示例8: test_offset_1part_1

 def test_offset_1part_1(self):
     # 0 length
     in_val = [pandas.Series()]
     expected = pandas.Series()
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(len(in_val), len(actual.columns))  # same number of columns?
     actual = actual['0']
     self.assertEqual(len(expected), len(actual))  # same number of rows?
     self.assertEqual(list(expected.index), list(actual.index))  # same row names?
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:11,代码来源:test_offset.py

示例9: test_offset_1part_4b

 def test_offset_1part_4b(self):
     # already regular offset interval to a very small one
     in_val = [pandas.Series(['a', 'b'], index=[0.0, 0.5])]
     expected = [pandas.Series(['a', 'a', 'a', 'a', 'b'], index=[0.0, 0.125, 0.25, 0.375, 0.5])]
     offset_interval = 0.125
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
     for i in xrange(len(expected)):
         self.assertEqual(len(expected[i]), len(actual[i]))  # same number of rows?
         self.assertEqual(list(expected[i].index), list(actual[i].index))  # same row names?
开发者ID:willingc,项目名称:vis,代码行数:11,代码来源:test_offset.py

示例10: test_offset_1part_1

 def test_offset_1part_1(self):
     # 0 length
     in_val = [pandas.Series()]
     expected = [pandas.Series()]
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
     for i in xrange(len(expected)):
         self.assertEqual(len(expected[i]), len(actual[i]))  # same number of rows?
         self.assertEqual(list(expected[i].index), list(actual[i].index))  # same row names?
开发者ID:willingc,项目名称:vis,代码行数:11,代码来源:test_offset.py

示例11: test_offset_1part_7

 def test_offset_1part_7(self):
     # irregular offset interval to a large one
     in_val = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.4, 1.1, 2.1])]
     expected = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 1.0, 2.0, 3.0])]
     offset_interval = 1.0
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
     for i in xrange(len(expected)):
         self.assertEqual(len(expected[i]), len(actual[i]))  # same number of rows?
         self.assertEqual(list(expected[i].index), list(actual[i].index))  # same row names?
开发者ID:willingc,项目名称:vis,代码行数:11,代码来源:test_offset.py

示例12: test_offset_1part_9

 def test_offset_1part_9(self):
     #  targeted test for end-of-piece: when last thing lands on an observed offset
     in_val = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.4, 1.1, 2.0])]
     expected = [pandas.Series(['a', 'b', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5, 2.0])]
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
     for i in xrange(len(expected)):
         self.assertEqual(len(expected[i]), len(actual[i]))  # same number of rows?
         self.assertEqual(list(expected[i].index), list(actual[i].index))  # same row names?
开发者ID:willingc,项目名称:vis,代码行数:11,代码来源:test_offset.py

示例13: test_offset_1part_5

 def test_offset_1part_5(self):
     # already regular offset interval (but some missing) to larger one
     in_val = [pandas.Series(['a', 'b', 'c'], index=[0.0, 0.5, 1.5])]
     expected = [pandas.Series(['a', 'b', 'c'], index=[0.0, 1.0, 2.0])]
     offset_interval = 1.0
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()
     self.assertEqual(len(expected), len(actual))  # same number of columns?
     for i in xrange(len(expected)):
         self.assertEqual(len(expected[i]), len(actual[i]))  # same number of rows?
         self.assertEqual(list(expected[i].index), list(actual[i].index))  # same row names?
开发者ID:willingc,项目名称:vis,代码行数:11,代码来源:test_offset.py

示例14: test_offset_1part_2

 def test_offset_1part_2(self):
     # input is expected output
     in_val = [pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5])]
     expected = pandas.Series(['a', 'b', 'c', 'd'], index=[0.0, 0.5, 1.0, 1.5])
     offset_interval = 0.5
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(1, len(actual.columns))  # same number of columns?
     actual = actual['0']
     self.assertSequenceEqual(list(expected.values), list(actual.values))  # same rows?
     self.assertSequenceEqual(list(expected.index), list(actual.index))  # same index?
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:11,代码来源:test_offset.py

示例15: test_offset_xparts_0a

 def test_offset_xparts_0a(self):
     # 0 length, many parts
     in_val = [pandas.Series(), pandas.Series(), pandas.Series(), pandas.Series()]
     expected = pandas.DataFrame({str(i): pandas.Series() for i in xrange(4)})
     offset_interval = 12.0
     ind = FilterByOffsetIndexer(in_val, {u'quarterLength': offset_interval})
     actual = ind.run()['offset.FilterByOffsetIndexer']
     self.assertEqual(len(expected.columns), len(actual.columns))
     expected = expected.fillna(value='None')  # avoid having to use isnan()
     actual = actual.fillna(value='None')
     for partname in expected.columns:
         self.assertSequenceEqual(list(expected[partname].values), list(actual[partname].values))
         self.assertSequenceEqual(list(expected[partname].index), list(actual[partname].index))
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:13,代码来源:test_offset.py


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