本文整理汇总了Python中pyexcel.sheets.nominablesheet.NominableSheet.name_rows_by_column方法的典型用法代码示例。如果您正苦于以下问题:Python NominableSheet.name_rows_by_column方法的具体用法?Python NominableSheet.name_rows_by_column怎么用?Python NominableSheet.name_rows_by_column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyexcel.sheets.nominablesheet.NominableSheet
的用法示例。
在下文中一共展示了NominableSheet.name_rows_by_column方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_formatter_by_named_row2
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
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"]
示例2: test_add
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
def test_add(self):
s = NominableSheet(self.data, "test")
s.name_rows_by_column(0)
data = OrderedDict({
"Row 5": [10, 11, 12]
}
)
s = s.row + data
assert s.row["Row 5"] == [10, 11, 12]
示例3: test_set_named_row
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
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]
示例4: test_delete_indexed_row2
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
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
示例5: test_add_wrong_type
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
def test_add_wrong_type(self):
s = NominableSheet(self.data, "test")
s.name_rows_by_column(0)
s = s.row + "string type" # bang
示例6: test_extend_rows_using_wrong_data_type
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
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_row_series_to_dict
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
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())
示例8: test_formatter_by_named_row_2
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
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"]
示例9: test_formatter_by_named_row
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_rows_by_column [as 别名]
def test_formatter_by_named_row(self):
s = NominableSheet(self.data, "test")
s.name_rows_by_column(0)
f = NamedRowFormatter("Row 1", str)
s.apply_formatter(f)
assert s.row["Row 1"] == ["1", "2", "3"]