html - Hyperlinks in a Pandas Dataframe in Python -
i have following bit of code:
class summary_tables(): def create_table(self, summary): formatting = formatter() table = pybloqs.htmljinjatableblock(summary,formatters=formatting.summary_format(), use_default_formatters=false) final_summary = pybloqs.vstack([table]) return final_summary class formatter(): def summary_format(self): table_center = pybloqs.fmtaligntable(alignment='center') align_cells = pybloqs.fmtaligncellcontents(alignment='center', apply_to_header_and_index=false) header = pybloqs.fmtheader(fixed_width='auto', column_width='5cm', index_width='1cm', top_padding='2cm') heatmap1 = pybloqs.fmtheatmap(axis=1, max_color=colors.heatmap_red, min_color=colors.heatmap_red, threshold=0.01) return [table_center, align_cells, header, heatmap1]
this me build , format html file pandas dataframe
called summary_df
:
mkt price_diff 0 appl '<a href="http://~price/appl_breakdown.html">3</a>' 1 goog '<a href="http://~price/goog_breakdown.html">0</a>' 2 msft '<a href="http://~price/msft_breakdown.html">2</a>'
so when run:
tables = summary_tables() summary_block = tables.create_table(summary_df) file = os.path.join(os.path.dirname('/home/jbloggs/'), 'summary.html') block_final = pybloqs.vstack([summary_block]) block_final.save(file)
i see expect when open html
file apart highlighting.. looking @ def summary_format()
in class formatter()
can see i'm trying build heatmap:
heatmap1 = pybloqs.fmtheatmap(axis=1, max_color=colors.heatmap_red, min_color=colors.heatmap_red, threshold=0.01)
problem is.. datframe
attaches number hyperlink:
'<a href="http://~price/appl_breakdown.html">3</a>'`
here can see link appl_breakdown.html
file linked number 3
..
how can resolve formatter function knows @ number rather hyperlink??
Comments
Post a Comment