I’m trying to insert this script on custom.js. I changes to color red all the negative currency.
I want it to be applied to all pandas dataframes printed on Jupyter. After adding it to all custom.js available on jupyter/anaconda folders, it still didn’t change anything. Can someone help me?
var allTableCells = document.getElementsByTagName("td"); for(var i = 0, max = allTableCells.length; i < max; i++) { var node = allTableCells[i]; //get the text from the first child node - which should be a text node var currentText = node.childNodes[0].nodeValue; //check for 'one' and assign this table cell's background color accordingly if (currentText.includes("$ -")) node.style.color = "red"; }
Advertisement
Answer
%%javascript var allTableCells = document.getElementsByTagName("td"); for(var i = 0, max = allTableCells.length; i < max; i++) { var node = allTableCells[i]; //get the text from the first child node - which should be a text node var currentText = node.childNodes[0].nodeValue; //check for 'one' and assign this table cell's background color accordingly if (currentText.includes("$ -")) node.style.color = "red"; }