本文整理汇总了Python中pyexcel.sheets.nominablesheet.NominableSheet.name_columns_by_row方法的典型用法代码示例。如果您正苦于以下问题:Python NominableSheet.name_columns_by_row方法的具体用法?Python NominableSheet.name_columns_by_row怎么用?Python NominableSheet.name_columns_by_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyexcel.sheets.nominablesheet.NominableSheet
的用法示例。
在下文中一共展示了NominableSheet.name_columns_by_row方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_formatter_by_named_column
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
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"]
示例2: test_series
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
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
示例3: test_add
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
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]
示例4: test_formatter_by_named_columns
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
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"]
示例5: test_add_wrong_type
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
def test_add_wrong_type(self):
"""Add string type"""
s = NominableSheet(self.data, "test")
s.name_columns_by_row(0)
s = s.column + "string type" # bang
示例6: test_set_indexed_row
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
def test_set_indexed_row(self):
s = NominableSheet(self.data, "test")
s.name_columns_by_row(2)
s.row[0] = [10000, 1, 11]
assert s.row[0] == [10000, 1, 11]
示例7: test_delete_named_column
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
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
示例8: test_formatter_by_named_column_2
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
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"]
示例9: test_delete_indexed_column
# 需要导入模块: from pyexcel.sheets.nominablesheet import NominableSheet [as 别名]
# 或者: from pyexcel.sheets.nominablesheet.NominableSheet import name_columns_by_row [as 别名]
def test_delete_indexed_column(self):
s = NominableSheet(self.data, "test")
s.name_columns_by_row(0)
s.delete_named_column_at(1)
assert s.number_of_columns() == 2
s.column["Column 2"] # access it after deletion, bang