Skip to content Skip to sidebar Skip to footer

Hyperlinks In A Pandas Dataframe In Python

I have the following bit of code: class summary_tables(): def create_table(self, summary): formatting = formatter() table = pybloqs.HTMLJinjaTableBlock(summary

Solution 1:

I once achieved something very similar by splitting the task into two steps:

1) In the raw dataframe, have only the numerical value. Then the heatmap formatter should pick it up easily.

2) Then change the cell contents to a string in a separate formatter that combines the cell value (the number) with the hyperlink. This is similar to converting a float to a pretty-printed format, so you could use e.g. FmtDecimals as a template (see this).

Since your convert-to-hyperlink formatter is quite specific to your application, you can keep that formatter code local in your module and you do not need to modify pybloqs itself. Just add the formatter to the end of the list of formatters. This is necessary since it will modify the cell contents, again similar to the formatters for pretty-printing floats.

Post a Comment for "Hyperlinks In A Pandas Dataframe In Python"