本文整理汇总了Python中scipy.io.arff.arffread.loadarff函数的典型用法代码示例。如果您正苦于以下问题:Python loadarff函数的具体用法?Python loadarff怎么用?Python loadarff使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadarff函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_filelike
def test_filelike(self):
"""Test reading from file-like object (StringIO)"""
f1 = open(test1)
f2 = StringIO(open(test1).read())
data1, meta1 = loadarff(f1)
data2, meta2 = loadarff(f2)
assert_(data1 == data2)
assert_(repr(meta1) == repr(meta2))
示例2: test_filelike
def test_filelike(self):
# Test reading from file-like object (StringIO)
f1 = open(test1)
data1, meta1 = loadarff(f1)
f1.close()
f2 = open(test1)
data2, meta2 = loadarff(StringIO(f2.read()))
f2.close()
assert_(data1 == data2)
assert_(repr(meta1) == repr(meta2))
示例3: test_path
def test_path(self):
# Test reading from `pathlib.Path` object
from pathlib import Path
with open(test1) as f1:
data1, meta1 = loadarff(f1)
data2, meta2 = loadarff(Path(test1))
assert_(data1 == data2)
assert_(repr(meta1) == repr(meta2))
示例4: test_nodata
def test_nodata(self):
# The file nodata.arff has no data in the @DATA section.
# Reading it should result in an array with length 0.
nodata_filename = os.path.join(data_path, 'nodata.arff')
data, meta = loadarff(nodata_filename)
expected_dtype = np.dtype([('sepallength', '<f8'),
('sepalwidth', '<f8'),
('petallength', '<f8'),
('petalwidth', '<f8'),
('class', 'S15')])
assert_equal(data.dtype, expected_dtype)
assert_equal(data.size, 0)
示例5: test_missing
def test_missing(self):
data, meta = loadarff(missing)
for i in ['yop', 'yap']:
assert_array_almost_equal(data[i], expect_missing[i])
示例6: _test
def _test(self, test_file):
data, meta = loadarff(test_file)
for i in range(len(data)):
for j in range(4):
assert_array_almost_equal(expect4_data[i][j], data[i][j])
assert_equal(meta.types(), expected_types)
示例7: setUp
def setUp(self):
self.data, self.meta = loadarff(test7)
示例8: setup_method
def setup_method(self):
self.data, self.meta = loadarff(test10)