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


Python arffread.read_header函数代码示例

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


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

示例1: test_badtype_parsing

    def test_badtype_parsing(self):
        """Test parsing wrong type of attribute from their value."""
        ofile = open(test3)
        rel, attrs = read_header(ofile)

        for name, value in attrs:
            assert_raises(ParseArffError, parse_type, value)
开发者ID:BeeRad-Johnson,项目名称:scipy-refactor,代码行数:7,代码来源:test_arffread.py

示例2: test_type_parsing

    def test_type_parsing(self):
        """Test parsing type of attribute from their value."""
        ofile = open(test2)
        rel, attrs = read_header(ofile)

        expected = ['numeric', 'numeric', 'numeric', 'numeric', 'numeric',
                    'numeric', 'string', 'string', 'nominal', 'nominal']

        for i in range(len(attrs)):
            assert parse_type(attrs[i][1]) == expected[i]
开发者ID:huard,项目名称:scipy-work,代码行数:10,代码来源:test_header.py

示例3: test_badtype_parsing

    def test_badtype_parsing(self):
        """Test parsing wrong type of attribute from their value."""
        ofile = open(test3)
        rel, attrs = read_header(ofile)

        for name, value in attrs:
            try:
                parse_type(value)
                raise Error("Could parse type of crap, should not happen.")
            except ParseArffError:
                pass
开发者ID:huard,项目名称:scipy-work,代码行数:11,代码来源:test_header.py

示例4: test_type_parsing

    def test_type_parsing(self):
        # Test parsing type of attribute from their value.
        ofile = open(test2)
        rel, attrs = read_header(ofile)
        ofile.close()

        expected = ['numeric', 'numeric', 'numeric', 'numeric', 'numeric',
                    'numeric', 'string', 'string', 'nominal', 'nominal']

        for i in range(len(attrs)):
            assert_(attrs[i].type_name == expected[i])
开发者ID:WarrenWeckesser,项目名称:scipy,代码行数:11,代码来源:test_arffread.py

示例5: test_dateheader_unsupported

    def test_dateheader_unsupported(self):
        ofile = open(test8)
        rel, attrs = read_header(ofile)
        ofile.close()

        assert_(rel == 'test8')

        assert_(len(attrs) == 2)
        assert_(attrs[0][0] == 'attr_datetime_utc')
        assert_(attrs[0][1] == 'DATE "yyyy-MM-dd HH:mm Z"')

        assert_(attrs[1][0] == 'attr_datetime_full')
        assert_(attrs[1][1] == 'DATE "yy-MM-dd HH:mm:ss z"')
开发者ID:AlgorithmFan,项目名称:scipy,代码行数:13,代码来源:test_arffread.py

示例6: test_fullheader1

    def test_fullheader1(self):
        """Parsing trivial header with nothing."""
        ofile = open(test1)
        rel, attrs = read_header(ofile)

        # Test relation
        assert rel == 'test1'

        # Test numerical attributes
        assert len(attrs) == 5
        for i in range(4):
            assert attrs[i][0] == 'attr%d' % i
            assert attrs[i][1] == 'REAL'
        classes = attrs[4][1]

        # Test nominal attribute
        assert attrs[4][0] == 'class'
        assert attrs[4][1] == '{class0, class1, class2, class3}'
开发者ID:huard,项目名称:scipy-work,代码行数:18,代码来源:test_header.py

示例7: test_fullheader1

    def test_fullheader1(self):
        # Parsing trivial header with nothing.
        ofile = open(test1)
        rel, attrs = read_header(ofile)
        ofile.close()

        # Test relation
        assert_(rel == 'test1')

        # Test numerical attributes
        assert_(len(attrs) == 5)
        for i in range(4):
            assert_(attrs[i][0] == 'attr%d' % i)
            assert_(attrs[i][1] == 'REAL')

        # Test nominal attribute
        assert_(attrs[4][0] == 'class')
        assert_(attrs[4][1] == '{class0, class1, class2, class3}')
开发者ID:AlgorithmFan,项目名称:scipy,代码行数:18,代码来源:test_arffread.py

示例8: test_fullheader1

    def test_fullheader1(self):
        """Parsing trivial header with nothing."""
        ofile = open(test1)
        rel, attrs = read_header(ofile)

        # Test relation
        assert_(rel == "test1")

        # Test numerical attributes
        assert_(len(attrs) == 5)
        for i in range(4):
            assert_(attrs[i][0] == "attr%d" % i)
            assert_(attrs[i][1] == "REAL")
        classes = attrs[4][1]

        # Test nominal attribute
        assert_(attrs[4][0] == "class")
        assert_(attrs[4][1] == "{class0, class1, class2, class3}")
开发者ID:mattyhk,项目名称:basketball-django,代码行数:18,代码来源:test_arffread.py

示例9: test_fullheader1

    def test_fullheader1(self):
        # Parsing trivial header with nothing.
        ofile = open(test1)
        rel, attrs = read_header(ofile)
        ofile.close()

        # Test relation
        assert_(rel == 'test1')

        # Test numerical attributes
        assert_(len(attrs) == 5)
        for i in range(4):
            assert_(attrs[i].name == 'attr%d' % i)
            assert_(attrs[i].type_name == 'numeric')

        # Test nominal attribute
        assert_(attrs[4].name == 'class')
        assert_(attrs[4].values == ('class0', 'class1', 'class2', 'class3'))
开发者ID:WarrenWeckesser,项目名称:scipy,代码行数:18,代码来源:test_arffread.py

示例10: test_type_parsing

    def test_type_parsing(self):
        # Test parsing type of attribute from their value.
        ofile = open(test2)
        rel, attrs = read_header(ofile)
        ofile.close()

        expected = [
            "numeric",
            "numeric",
            "numeric",
            "numeric",
            "numeric",
            "numeric",
            "string",
            "string",
            "nominal",
            "nominal",
        ]

        for i in range(len(attrs)):
            assert_(parse_type(attrs[i][1]) == expected[i])
开发者ID:Benj1,项目名称:scipy,代码行数:21,代码来源:test_arffread.py

示例11: test_dateheader

    def test_dateheader(self):
        ofile = open(test7)
        rel, attrs = read_header(ofile)
        ofile.close()

        assert_(rel == 'test7')

        assert_(len(attrs) == 5)

        assert_(attrs[0][0] == 'attr_year')
        assert_(attrs[0][1] == 'DATE yyyy')

        assert_(attrs[1][0] == 'attr_month')
        assert_(attrs[1][1] == 'DATE yyyy-MM')

        assert_(attrs[2][0] == 'attr_date')
        assert_(attrs[2][1] == 'DATE yyyy-MM-dd')

        assert_(attrs[3][0] == 'attr_datetime_local')
        assert_(attrs[3][1] == 'DATE "yyyy-MM-dd HH:mm"')

        assert_(attrs[4][0] == 'attr_datetime_missing')
        assert_(attrs[4][1] == 'DATE "yyyy-MM-dd HH:mm"')
开发者ID:AlgorithmFan,项目名称:scipy,代码行数:23,代码来源:test_arffread.py

示例12: test_dateheader

    def test_dateheader(self):
        ofile = open(test7)
        rel, attrs = read_header(ofile)
        ofile.close()

        assert_(rel == 'test7')

        assert_(len(attrs) == 5)

        assert_(attrs[0].name == 'attr_year')
        assert_(attrs[0].date_format == '%Y')

        assert_(attrs[1].name == 'attr_month')
        assert_(attrs[1].date_format == '%Y-%m')

        assert_(attrs[2].name == 'attr_date')
        assert_(attrs[2].date_format == '%Y-%m-%d')

        assert_(attrs[3].name == 'attr_datetime_local')
        assert_(attrs[3].date_format == '%Y-%m-%d %H:%M')

        assert_(attrs[4].name == 'attr_datetime_missing')
        assert_(attrs[4].date_format == '%Y-%m-%d %H:%M')
开发者ID:WarrenWeckesser,项目名称:scipy,代码行数:23,代码来源:test_arffread.py

示例13: read_dateheader_unsupported

 def read_dateheader_unsupported():
     ofile = open(test8)
     rel, attrs = read_header(ofile)
     ofile.close()
开发者ID:WarrenWeckesser,项目名称:scipy,代码行数:4,代码来源:test_arffread.py

示例14: badtype_read

 def badtype_read():
     ofile = open(test3)
     rel, attrs = read_header(ofile)
     ofile.close()
开发者ID:WarrenWeckesser,项目名称:scipy,代码行数:4,代码来源:test_arffread.py


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