當前位置: 首頁>>代碼示例>>Python>>正文


Python nominablesheet.NominableSheet類代碼示例

本文整理匯總了Python中pyexcel.sheets.nominablesheet.NominableSheet的典型用法代碼示例。如果您正苦於以下問題:Python NominableSheet類的具體用法?Python NominableSheet怎麽用?Python NominableSheet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了NominableSheet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_series

 def test_series(self):
     s = NominableSheet(self.data, "test")
     s.name_columns_by_row(2)
     assert s.colnames == ["Column 1", "Column 2", "Column 3"]
     custom_columns = ["C1", "C2", "C3"]
     s.colnames = custom_columns
     assert s.colnames == custom_columns
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:7,代碼來源:test_sheets.py

示例2: test_formatter_by_named_column

 def test_formatter_by_named_column(self):
     """Test one named column"""
     s = NominableSheet(self.data, "test")
     s.name_columns_by_row(0)
     f = NamedColumnFormatter("Column 1", str)
     s.apply_formatter(f)
     assert s.column["Column 1"] == ["1", "4", "7"]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:7,代碼來源:test_sheets.py

示例3: test_formatter_by_named_columns

 def test_formatter_by_named_columns(self):
     """Test multiple named columns"""
     s = NominableSheet(self.data, "test")
     s.name_columns_by_row(0)
     f = NamedColumnFormatter(["Column 1", "Column 3"], str)
     s.apply_formatter(f)
     assert s.column["Column 1"] == ["1", "4", "7"]
     assert s.column["Column 3"] == ["3", "6", "9"]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:8,代碼來源:test_sheets.py

示例4: test_formatter_by_named_row2

 def test_formatter_by_named_row2(self):
     """Test a list of string as index"""
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     f = NamedRowFormatter(["Row 1", "Row 2"], str)
     s.apply_formatter(f)
     assert s.row["Row 1"] == ["1", "2", "3"]
     assert s.row["Row 2"] == ["4", "5", "6"]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:8,代碼來源:test_sheets.py

示例5: test_add

 def test_add(self):
     s = NominableSheet(self.data, "test")
     s.name_columns_by_row(0)
     data = OrderedDict({
         "Column 4": [10, 11, 12]
     })
     s = s.column + data
     assert s.column["Column 4"] == [10, 11, 12]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:8,代碼來源:test_sheets.py

示例6: test_extend_rows_using_wrong_data_type

 def test_extend_rows_using_wrong_data_type(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.extend_rows([1, 2])
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:4,代碼來源:test_sheets.py

示例7: test_formatter_by_named_column_2

 def test_formatter_by_named_column_2(self):
     s = NominableSheet(self.data, "test")
     s.name_columns_by_row(2)
     s.column.format("Column 1", str)
     assert s.column["Column 1"] == ["1", "4", "7"]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:5,代碼來源:test_sheets.py

示例8: test_set_indexed_column

 def test_set_indexed_column(self):
     s = NominableSheet(self.data, "test", name_rows_by_column=0)
     s.column[0] = [12, 3, 4, 5]
     assert s.column[0] == [12, 3, 4, 5]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:4,代碼來源:test_sheets.py

示例9: test_set_named_row

 def test_set_named_row(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.row["Row 2"] = [11, 11, 11]
     assert s.row["Row 2"] == [11, 11, 11]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:5,代碼來源:test_sheets.py

示例10: test_delete_indexed_row2

 def test_delete_indexed_row2(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.delete_named_row_at(2)
     assert s.number_of_rows() == 3
     s.row["Row 2"]  # already deleted
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:6,代碼來源:test_sheets.py

示例11: test_add_wrong_type

 def test_add_wrong_type(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s = s.row + "string type"  # bang
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:4,代碼來源:test_sheets.py

示例12: test_delete_named_column

 def test_delete_named_column(self):
     s = NominableSheet(self.data, "test")
     s.name_columns_by_row(2)
     del s.column["Column 2"]
     assert s.number_of_columns() == 2
     s.column["Column 2"]  # bang
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:6,代碼來源:test_sheets.py

示例13: test_row_series_to_dict

 def test_row_series_to_dict(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     content = s.to_dict(True)
     keys = ["Row 0", "Row 1", "Row 2", "Row 3"]
     assert keys == list(content.keys())
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:6,代碼來源:test_sheets.py

示例14: test_formatter_by_named_row_2

 def test_formatter_by_named_row_2(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.row.format("Row 1", str)
     assert s.row["Row 1"] == ["1", "2", "3"]
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:5,代碼來源:test_sheets.py

示例15: test_rownames

 def test_rownames(self):
     s = NominableSheet(self.data, "test", name_rows_by_column=0)
     assert s.rownames == ["Row 0", "Row 1", "Row 2", "Row 3"]
     custom_rows = ["R0", "R1", "R2", "R3"]
     s.rownames = custom_rows
     assert s.rownames == custom_rows
開發者ID:chiyodad,項目名稱:pyexcel,代碼行數:6,代碼來源:test_sheets.py


注:本文中的pyexcel.sheets.nominablesheet.NominableSheet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。