gpt4 book ai didi

javascript - 如何将javascript代码插入Jupyter

转载 作者:行者123 更新时间:2023-11-30 11:44:49 26 4
gpt4 key购买 nike

我正在尝试将此脚本插入到 custom.js 中。我将所有负货币更改为红色。

我希望它应用于在 Jupyter 上打印的所有 pandas 数据帧。将其添加到 jupyter/anaconda 文件夹中所有可用的 custom.js 后,它仍然没有任何改变。有人可以帮助我吗?

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";
}

最佳答案

%%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";
}

关于javascript - 如何将javascript代码插入Jupyter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41351156/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com