pyexcel.Sheet.map¶
-
Sheet.
map
(custom_function)¶ Execute a function across all cells of the sheet
Example:
>>> import pyexcel as pe >>> # Given a dictinoary as the following >>> data = { ... "1": [1, 2, 3, 4, 5, 6, 7, 8], ... "3": [1.25, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8], ... "5": [2, 3, 4, 5, 6, 7, 8, 9], ... "7": [1, '',] ... } >>> sheet = pe.get_sheet(adict=data) >>> sheet.row[1] [1, 1.25, 2, 1] >>> inc = lambda value: (float(value) if value != None else 0)+1 >>> sheet.map(inc) >>> sheet.row[1] [2.0, 2.25, 3.0, 2.0]