本文整理汇总了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
示例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"]
示例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"]
示例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"]
示例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]
示例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])
示例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"]
示例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]
示例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]
示例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
示例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
示例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
示例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())
示例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"]
示例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