def template_clean_data(p, clean_data, features, items, cleaners_names, filter_names): p(html.h2(u'Clean data:')) with p(html.div({u'id':u'clean_data', u'style':u'height:20em;overflow:scroll;'})): with p(html.table()): with p(html.tr()): p(html.td(' ')) for i,f in enumerate(features): with p(html.td_block()): p(html.b(u'Missing:')) p(html.br()) p(u'<select class="cleaners">') for name in cleaner_funcs: p(u'<option') if name == cleaners_names[i]: p(u' SELECTED="SELECTED"') p(u' value="%s"' % name) p(u'>') p(name) p(u'</option>') p(u'</select>') p(html.br()) p(html.br()) p(html.b(u'Filters:')) p(html.br()) with p(html.div({u'class':u'filters'})): for f in filter_funcs: p(u'<input type="checkbox"') if f in filter_names[i]: p(u' checked="checked"') p(u' name="%s"' % f) p(u'>') p(f) p(u'</input>') p(html.br()) with p(html.tr()): p(html.td(u' ')) for f in features: with p(html.td_block({u'valign':u'top'})): p(html.b(f)) for item,row in zip(items, clean_data): with p(html.tr()): p(html.td(html.b(item))) for cell in row: if isinstance(cell, ChangedFloat): p(html.td(html.b(u'%.6s ' % cell) + html.span(cell.original, {u'style':u'"font-size:smaller;color:gray;"'}))) else: p(html.td('%.6s' % cell))
def partial_linked_financials_table(t, table, ticker, table_number): column_headings = sorted_column_headings_from_table(table) with t(html.table(attrs={'width':'100%'})): with t(html.thead()): t(html.th(u' ')) t(html.th(u' ')) for c in column_headings: attrs = {'style':'width:70px;text-align:right;v-align:top;'} t(html.th(unicode(c), attrs=attrs)) colors = cycle(['FFFFFF', 'CCFFFF']) for color, (line_item, values) in izip(colors, table): with t(html.tr({'style':'background-color:%s;' % color})): t(html.td(unicode(line_item), attrs={'style':'width:400px;'})) t(html.td(u' ')) for c in column_headings: if c in values: attrs = {'style': 'width:90px;text-align:right;v-align:top;'} num = values[c] link = html.a(originals.url(ticker) + '?num=%s#table-%s' % (int(num), table_number), number_in_table(num), attrs={'class':'num'}) t(html.td(link, attrs=attrs)) else: t(html.td(u' '))
def partial_table(p, table): with p(html.table()): for row in table: with p(html.tr()): for cell in row: p(html.td(cell))