Hi everybody!
I am building a small app with dash plotly and i faced a problem with datatables. I am trying to highlite some values in table which is above or below some normative (“Норматив” column). But i need values to be with % symbol in the table example below:
So the problem is with blanks and with 100% values — it doesn’t calculate difference with normative properly. I tried to handle it manually, but it also doesnt’t work. So i am thinking that “not” operator would help me with more custom filter_query setup.
My code is:
cols = list(df.columns)
cols = cols[5:]
styles = [{'if': {'row_index': 'odd'},
'backgroundColor': 'rgb(243, 243, 243)'}]
for i in cols:
if maximisation:
styles.append({
'if': {
'filter_query': '{{{col}}} < {{{col1}}} && {{{col}}} > {null} && {{{col}}} != "100.0%"'.format(
col=i, col1='Норматив', null=0.001%
),
'column_id': i
},
'backgroundColor': '#F012BE',
'fontWeight': 'bold'
})
else:
styles.append({
'if': {
'filter_query': '{{{col}}} > {{{col1}}}'.format(
col=i, col1='Норматив'
),
'column_id': i
},
'backgroundColor': '#F012BE',
'fontWeight': 'bold'
})
Dose “not” exists but haven’t been mentioned in docs or am i doing something wrong?
Anyways, thanks for your time if you have read this.