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


Python pyexcel.load_book函数代码示例

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


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

示例1: test_delete_sheets

 def test_delete_sheets(self):
     """Can delete by sheet name"""
     b1 = pe.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1["Sheet1"]
     assert len(b1.sheet_names()) == 2
     del b1["Sheet1"]  # bang, already deleted
开发者ID:ChiangFamily,项目名称:pyexcel,代码行数:7,代码来源:test_multiple_sheets.py

示例2: test_delete_sheets2

 def test_delete_sheets2(self):
     """Can delete by index"""
     b1 = pe.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1[2]
     del b1[1]
     assert len(b1.sheet_names()) == 1
     del b1[1]  # bang, already deleted
开发者ID:ChiangFamily,项目名称:pyexcel,代码行数:8,代码来源:test_multiple_sheets.py

示例3: test_delete_sheets2

 def test_delete_sheets2(self):
     """repetitively delete first sheet"""
     b1 = pyexcel.load_book(self.testfile)
     del b1[0]
     assert len(b1.sheet_names()) == 2
     del b1[0]
     assert len(b1.sheet_names()) == 1
     del b1[0]
     assert len(b1.sheet_names()) == 0
开发者ID:mromero107,项目名称:pyexcel-xls,代码行数:9,代码来源:test_mutliple_sheets.py

示例4: test_read_multiple_csv_into_book

 def test_read_multiple_csv_into_book(self):
     book = pe.load_book(self.testfile)
     assert book.sheet_names() == ["Sheet1", "Sheet2", "Sheet3"]
     book["Sheet1"].format(int)
     assert self.content["Sheet1"] == book["Sheet1"].to_array()
     book["Sheet2"].format(int)
     assert self.content["Sheet2"] == book["Sheet2"].to_array()
     book["Sheet3"].format(int)
     assert self.content["Sheet3"] == book["Sheet3"].to_array()
开发者ID:ChiangFamily,项目名称:pyexcel,代码行数:9,代码来源:test_multiple_sheets.py

示例5: test_read_custom_made_csvz_multiple_hseet

 def test_read_custom_made_csvz_multiple_hseet(self):
     data = [[1, 4, 9], [2, 5, 8], [3, 6, 7]]
     book = pe.load_book(os.path.join("tests", "fixtures", "test-multiple.csvz"))
     assert book.sheet_names() == ["sheet1", "sheet2", "sheet3"]
     book[0].format(int)
     book[1].format(int)
     book[2].format(int)
     assert data == book[0].to_array()
     assert data == book[1].to_array()
     assert data == book[2].to_array()
开发者ID:bdeeney,项目名称:pyexcel,代码行数:10,代码来源:test_io_csvzipbook.py

示例6: test_issue_03

 def test_issue_03(self):
     file_prefix = "issue_03_test"
     csv_file = "%s.csv" % file_prefix
     xls_file = "%s.xls" % file_prefix
     my_sheet_name = "mysheetname"
     data = [[1,1]]
     sheet = pe.Sheet(data, name=my_sheet_name)
     sheet.save_as(csv_file)
     assert(os.path.exists(csv_file))
     sheet.save_as(xls_file)
     book = pe.load_book(xls_file)
     assert book.sheet_names()[0] == my_sheet_name
     os.unlink(csv_file)
     os.unlink(xls_file)
开发者ID:jayvdb,项目名称:pyexcel,代码行数:14,代码来源:test_bug_fixes.py

示例7: test_delete_sheets

 def test_delete_sheets(self):
     b1 = pyexcel.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1["Sheet1"]
     assert len(b1.sheet_names()) == 2
     try:
         del b1["Sheet1"]
         assert 1==2
     except KeyError:
         assert 1==1
     del b1[1]
     assert len(b1.sheet_names()) == 1
     try:
         del b1[1]
         assert 1==2
     except IndexError:
         assert 1==1
开发者ID:mromero107,项目名称:pyexcel-xls,代码行数:17,代码来源:test_mutliple_sheets.py

示例8: test_load_a_single_sheet4

 def test_load_a_single_sheet4(self):
     pyexcel.load_book(self.testfile, sheet_name="Not exist")
开发者ID:mromero107,项目名称:pyexcel-xls,代码行数:2,代码来源:test_mutliple_sheets.py

示例9: test_load_a_single_sheet3

 def test_load_a_single_sheet3(self):
     pyexcel.load_book(self.testfile, sheet_index=10000)
开发者ID:mromero107,项目名称:pyexcel-xls,代码行数:2,代码来源:test_mutliple_sheets.py

示例10: test_load_a_single_sheet2

 def test_load_a_single_sheet2(self):
     b1 = pyexcel.load_book(self.testfile, sheet_index=2)
     assert len(b1.sheet_names()) == 1
     assert b1['Sheet3'].to_array() == self.content['Sheet3']
开发者ID:mromero107,项目名称:pyexcel-xls,代码行数:4,代码来源:test_mutliple_sheets.py

示例11: test_book_reader_to_dict2

 def test_book_reader_to_dict2(self):
     r = pe.load_book(self.testfile)
     actual = r.to_dict()
     self.assertEqual(self.content, actual)
开发者ID:dardevelin,项目名称:pyexcel,代码行数:4,代码来源:test_utils.py

示例12: test_delete_sheets3

 def test_delete_sheets3(self):
     """Test float in []"""
     b1 = pe.load_book(self.testfile)
     del b1[1.1]
开发者ID:ChiangFamily,项目名称:pyexcel,代码行数:4,代码来源:test_multiple_sheets.py

示例13: test_load_a_single_sheet2

 def test_load_a_single_sheet2(self):
     b1 = pe.load_book(self.testfile, sheet_index=1)
     b1['Sheet2'].format(int)
     assert len(b1.sheet_names()) == 1
     assert b1['Sheet2'].to_array() == self.content['Sheet2']
开发者ID:ChiangFamily,项目名称:pyexcel,代码行数:5,代码来源:test_multiple_sheets.py

示例14: test_book_reader_to_dict2

 def test_book_reader_to_dict2(self):
     r = pe.load_book(self.testfile)
     actual = r.to_dict()
     assert actual == self.content
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:4,代码来源:test_utils.py


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