Table class with CSV I/O, easy access to columns, HTML output
-
class table.Table(filename=None, titles=[], init=[], **kwargs)[source]
Bases: list
Table class with CSV I/O, easy access to columns, HTML output
inits a table either from data or csv file
-
__init__(filename=None, titles=[], init=[], **kwargs)[source]
inits a table either from data or csv file
-
__repr__()[source]
-
__str__()[source]
-
html(page, head=None, foot=None, colstyle=None, **kwargs)[source]
output HTML on a markup.page
-
read_xls(filename, **kwargs)[source]
appends an Excel table
-
read_csv(filename, **kwargs)[source]
appends a .csv or similar file to the table
-
write_csv(filename, transpose=False, **kwargs)[source]
write the table in Excel csv format, optionally transposed
-
ncols()[source]
return number of columns, ignoring title
-
find_col(title)[source]
finds a column from a part of the title
-
icol(by)[source]
iterates column
-
col(by)[source]
-
get(row, col)[source]
-
set(row, col, value)[source]
-
setcol(by, val, i=0)[source]
set column
-
addcol(title, val=None, i=0)[source]
add column to the right
-
sort(by, reverse=False)[source]
sort by column
-
rowasdict(i)[source]
returns a line as a dict
-
groupby(by, sort=True, removecol=True)[source]
dictionary of subtables grouped by a column
-
hierarchy(by='Level', factory=<function <lambda> at 0x048273F0>, linkfct=<function <lambda> at 0x04827430>)[source]
builds a structure from a table containing a “level” column
-
applyf(by, f, safe=True)[source]
apply a function to a column
-
to_datetime(by, fmt='%d.%m.%Y', safe=True)[source]
convert a column to datetime
-
to_date(by, fmt='%d.%m.%Y', safe=True)[source]
convert a column to date
-
total(funcs)[source]
builds a list by appling f functions to corresponding columns
-
remove_lines_where(filter)[source]
remove lines on a condition, returns the number of lines removed
-
__weakref__
list of weak references to the object (if defined)