• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyexcel.load函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_row_in_file_filter

 def test_row_in_file_filter(self):
     r1 = pe.load("testcsv1.csv")
     r2 = pe.load("testcsv2.csv")
     r2.filter(pe.filters.ColumnFilter([2]))
     r1.filter(pe.filters.RowInFileFilter(r2))
     result = [1, 'a', 2, 'b', 3, 'c', 8, 'h']
     actual = pe.utils.to_array(r1.enumerate())
     self.assertEqual(result, actual)
开发者ID:chiyodad,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例2: test_row_value_filter

 def test_row_value_filter(self):
     r1 = pe.load("testcsv1.csv")
     r2 = pe.load("testcsv2.csv")
     filter_func = lambda array: r2.contains((lambda row: array[0] == row[0] and array[1] == row[1]))
     r1.filter(pe.filters.RowValueFilter(filter_func).invert())
     result = ['1', 'a', '2', 'b', '3', 'c', '8', 'h']
     actual = pe.utils.to_array(r1.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例3: test_row_in_file_filter

 def test_row_in_file_filter(self):
     r1 = pe.load("testcsv1.csv")
     r2 = pe.load("testcsv2.csv")
     r2.filter(pe.filters.ColumnFilter([2]))
     r1.filter(pe.filters.RowInFileFilter(r2))
     result = ['1', 'a', '2', 'b', '3', 'c', '8', 'h']
     actual = pe.utils.to_array(r1.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例4: test_row_value_filter

    def test_row_value_filter(self):
        r1 = pe.load("testcsv1.csv")
        r2 = pe.load("testcsv2.csv")

        def filter_func(array):
            def func(row): return array[0] == row[0] and array[1] == row[1]
            return r2.contains(func)
        r1.filter(pe.filters.RowValueFilter(filter_func).invert())
        result = [1, 'a', 2, 'b', 3, 'c', 8, 'h']
        actual = pe.utils.to_array(r1.enumerate())
        self.assertEqual(result, actual)
开发者ID:chiyodad,项目名称:pyexcel,代码行数:11,代码来源:test_filter.py


示例5: test_pyexcel_issue_5

    def test_pyexcel_issue_5(self):
        """pyexcel issue #5

        datetime is not properly parsed
        """
        s = pe.load(os.path.join("tests",
                                 "test-fixtures",
                                 "test-date-format.xls"))
        s.save_as("issue5.xlsx")
        s2 = pe.load("issue5.xlsx")
        print(s[0,0])
        assert s[0,0] == datetime.datetime(2015, 11, 11, 11, 12, 0)
        assert s2[0,0] == datetime.datetime(2015, 11, 11, 11, 12, 0)
开发者ID:mromero107,项目名称:pyexcel-xlsx,代码行数:13,代码来源:test_bug_fixes.py


示例6: test_pyexcel_issue_5

def test_pyexcel_issue_5():
    """pyexcel issue #5

    datetime is not properly parsed
    """
    s = pe.load(get_fixture("test-date-format.xls"))
    assert s[0, 0] == datetime.datetime(2015, 11, 11, 11, 12, 0)
开发者ID:pyexcel,项目名称:pyexcel-xls,代码行数:7,代码来源:test_bug_fixes.py


示例7: test_pyexcel_issue_8_with_memory_file

    def test_pyexcel_issue_8_with_memory_file(self):
        """pyexcel issue #8

        formular got lost
        """
        tmp_file = "issue_8_save_as.xlsx"
        f = open(os.path.join("tests",
                              "test-fixtures",
                              "test8.xlsx"),
                 "rb")
        s = pe.load_from_memory('xlsx', f.read())
        s.save_as(tmp_file)
        s2 = pe.load(tmp_file)
        assert str(s) == str(s2)
        content = dedent("""
        Sheet Name: CNY
        +----------+----------+------+---+--------+
        | 01/09/13 | 02/09/13 | 1000 | 5 | 13.890 |
        +----------+----------+------+---+--------+
        | 02/09/13 | 03/09/13 | 2000 | 6 | 33.330 |
        +----------+----------+------+---+--------+
        | 03/09/13 | 04/09/13 | 3000 | 7 | 58.330 |
        +----------+----------+------+---+--------+""").strip("\n")
        assert str(s2) == content
        os.unlink(tmp_file)
开发者ID:mromero107,项目名称:pyexcel-xlsx,代码行数:25,代码来源:test_bug_fixes.py


示例8: test_even_row_filter

 def test_even_row_filter(self):
     r = pe.load(self.test_tuple)
     r.filter(pe.filters.EvenRowFilter())
     assert r.number_of_rows() == 2
     assert r.number_of_columns() == 4
     result = [1, 2, 3, 4, 9, 10, 11, 12]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例9: test_write_and_read

 def test_write_and_read(self):
     data = [[11, 112], [312, 534]]
     sheet = pe.Sheet(data)
     sheet.save_as(self.testfile)
     sheet2 = pe.load(self.testfile)
     sheet2.format(int)
     result = sheet2.to_array()
     assert data == result
开发者ID:bdeeney,项目名称:pyexcel,代码行数:8,代码来源:test_io_csvzipbook.py


示例10: test_column_filter_with_invalid_indices

 def test_column_filter_with_invalid_indices(self):
     r = pe.load((self.file_type, self.testfile.getvalue()))
     r.filter(pe.filters.ColumnFilter([11, -1]))
     assert r.number_of_rows() == 3
     assert r.number_of_columns() == 4
     result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例11: test_row_filter_with_invalid_indices

 def test_row_filter_with_invalid_indices(self):
     r = pe.load(self.test_tuple)
     r.filter(pe.filters.RowFilter([11, -1]))
     assert r.number_of_rows() == 3
     assert r.number_of_columns() == 4
     result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例12: test_single_row_filter

 def test_single_row_filter(self):
     r = pe.load((self.file_type, self.testfile.getvalue()))
     r.filter(pe.filters.SingleRowFilter(1))
     assert r.number_of_rows() == 2
     assert r.number_of_columns() == 4
     result = [1, 2, 3, 4, 9, 10, 11, 12]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例13: test_odd_row_filter

 def test_odd_row_filter(self):
     r = pe.load(self.test_tuple)
     r.filter(pe.filters.OddRowFilter())
     assert r.number_of_rows() == 1
     assert r.number_of_columns() == 4
     result = [5, 6, 7, 8]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例14: test_even_column_filter

 def test_even_column_filter(self):
     r = pe.load(self.test_tuple)
     r.filter(pe.filters.EvenColumnFilter())
     assert r.number_of_rows() == 3
     assert r.number_of_columns() == 2
     result = [1, 3, 5, 7, 9, 11]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例15: test_odd_column_filter

 def test_odd_column_filter(self):
     r = pe.load(self.test_tuple)
     r.filter(pe.filters.OddColumnFilter())
     assert r.number_of_rows() == 3
     assert r.number_of_columns() == 2
     result = [2, 4, 6, 8, 10, 12]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例16: test_single_column_filter_double_invert

 def test_single_column_filter_double_invert(self):
     r = pe.load((self.file_type, self.testfile.getvalue()))
     r.filter(pe.filters.SingleColumnFilter(0).invert().invert())
     assert r.number_of_rows() == 3
     assert r.number_of_columns() == 3
     result = [2, 3, 4, 6, 7, 8, 10, 11, 12]
     actual = pe.utils.to_array(r.enumerate())
     assert result == actual
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:test_filter.py


示例17: main

def main(base_dir):
    # "example.csv","example.ods","example.xls", "example.xlsm"
    spreadsheet = pe.load(os.path.join(base_dir,"example.xlsx"))
    
    # columns() returns column based iterator, meaning it can be iterated
    # column by column 
    for value in spreadsheet.columns():
        print(value)
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:8,代码来源:read_column_by_column.py


示例18: test_pyexcel_issue_5

    def test_pyexcel_issue_5(self):
        """pyexcel issue #5

        datetime is not properly parsed
        """
        s = pe.load(os.path.join("tests",
                                 "test-fixtures",
                                 "test-date-format.xls"))
        assert s[0, 0] == datetime.datetime(2015, 11, 11, 11, 12, 0)
开发者ID:gamer-007,项目名称:pyexcel-xls,代码行数:9,代码来源:test_bug_fixes.py


示例19: test_row_index_filter

    def test_row_index_filter(self):
        r = pe.load(self.test_tuple)

        def filter_func(x): return x in [1]
        r.add_filter(pe.filters.RowIndexFilter(filter_func))
        assert r.number_of_rows() == 2
        assert r.number_of_columns() == 4
        result = [1, 2, 3, 4, 9, 10, 11, 12]
        actual = pe.utils.to_array(r.enumerate())
        assert result == actual
开发者ID:chiyodad,项目名称:pyexcel,代码行数:10,代码来源:test_filter.py


示例20: test_column_index_filter

    def test_column_index_filter(self):
        r = pe.load(self.test_tuple)

        def test_func(x): return x in [0, 2]
        r.add_filter(pe.filters.ColumnIndexFilter(test_func))
        assert r.number_of_rows() == 3
        assert r.number_of_columns() == 2
        result = [2, 4, 6, 8, 10, 12]
        actual = pe.utils.to_array(r.enumerate())
        assert result == actual
开发者ID:chiyodad,项目名称:pyexcel,代码行数:10,代码来源:test_filter.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyexcel.load_book函数代码示例发布时间:2022-05-25
下一篇:
Python pyexcel.get_sheet函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap