How can I apply a custom mask to allow dynamic formatting #774
-
|
Hey All, not sure if this is the right place for this question, is there a way to apply a custom mask to the GT for more dynamic formatting? I.e. want to highlight particular cells in the table based on the value of cells and data both inside and outside of the table (i.e. from parts used to assemble the table), but not based on the value of the cell itself. According to the Documentation, it appears that I can utilise the mask functionality. Wrote some code to generate a Boolean polar table that corresponds to my table, but I can't seem to figure out how to implement it. Any suggestions for how to create some dynamic formatting? I also tried to see if I could use eval and just brute force the formattin,g but GT doesn't like eval. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
@JfosterBGC, I believe this is the right place to share your experience. I'm sorry, but I’m not sure I fully understand the issue. It would be great if you could provide a small example showing the input and output, and I’ll see if I can help. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the explanation. I think I now have a rough idea of your work. |
Beta Was this translation helpful? Give feedback.
-
|
For those Looking back on this, I was able to solve it by doing the following: First I went back into table building function and added a "From_Analysis" Column to the dataframe so I explicitly had a list of which analysis the slip surface was critical for. then when in it came to the plot i did the following:
in this block I loop through each of the analsis columns (Col) one at a time. I hope others find this useful :) |
Beta Was this translation helpful? Give feedback.


For those Looking back on this, I was able to solve it by doing the following:
First I went back into table building function and added a "From_Analysis" Column to the dataframe so I explicitly had a list of which analysis the slip surface was critical for.
then when in it came to the plot i did the following:
# Format the Critical FoS values in box for Col in [c for c in FoS_not_empty if not 'FoS_Ratio' in c]: ssID = Sub_df['Slip_Surface_ID'][Sub_df['From_Analysis'].apply(lambda x:Col in x)].to_list() idxs = Sub_df[Sub_df['From_Analysis'].apply(lambda x:Col in x)].index.to_list() TBL = TBL.tab_style(style = style.borders(sides="all", color = "#FF000087", style='solid', weight=3), locati…