pyexcel.sheets.NamedRow¶
-
class
pyexcel.sheets.
NamedRow
(matrix)[source]¶ Series Sheet would have Named Row instead of Row
Here is an example to merge sheets. Suppose we have the following three files:
>>> import pyexcel as pe >>> data = [[1,2,3],[4,5,6],[7,8,9]] >>> s = pe.Sheet(data) >>> s.save_as("1.csv") >>> data2 = [['a','b','c'],['d','e','f'],['g','h','i']] >>> s2 = pe.Sheet(data2) >>> s2.save_as("2.csv") >>> data3=[[1.1, 2.2, 3.3],[4.4, 5.5, 6.6],[7.7, 8.8, 9.9]] >>> s3=pe.Sheet(data3) >>> s3.save_as("3.csv") >>> merged = pe.Sheet() >>> for file in ["1.csv", "2.csv", "3.csv"]: ... r = pe.get_sheet(file_name=file) ... merged.row += r >>> merged.save_as("merged.csv")
Now let’s verify what we had:
>>> r=pe.get_sheet(file_name="merged.csv")
this is added to overcome doctest’s inability to handle python 3’s unicode:
>>> r.format(lambda v: str(v)) >>> print(pe.utils.to_array(r)) [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'], ['1.1', '2.2', '3.3'], ['4.4', '5.5', '6.6'], ['7.7', '8.8', '9.9']]
-
__init__
(matrix)¶
Methods
-