[英]dtale show in jupyter notebook
I am exploring this new Python
package named dtale
.我正在探索这个名为dtale
新Python
包。 It is very convenient for pandas
data frames visualization. pandas
数据框可视化非常方便。
https://pypi.org/project/dtale/ https://pypi.org/project/dtale/
It worked once after 2 hours of loading.加载 2 小时后它工作了一次。
Here is a reproduction of the code, where I reduce the dataset.这是代码的再现,我在其中减少了数据集。 It still takes hours to load on Jupyter Notebook.在 Jupyter Notebook 上加载仍然需要数小时。
import pandas as pd
import dtale
table = pd.DataFrame([[1, 2], [3, 4]], columns = ['a','b'])
d = dtale.show(table)
d
Comments from @cup and @AMC suggested to use it outside Jupyter notebook which I did using python console.来自@cup 和@AMC 的评论建议在我使用 python 控制台所做的 Jupyter notebook 之外使用它。 It worked fine.它工作得很好。
Any ideas on what is taking so long between Jupyter Notebook and Dtale?关于 Jupyter Notebook 和 Dtale 之间需要这么长时间的任何想法?
Edit: It is not realy taking so long.编辑:它并没有真正花这么长时间。 The process block jupyter notebook while the data is accessible through the local link.当数据可通过本地链接访问时,进程会阻止 jupyter notebook。 http://LT0PAR01056937:40000/dtale/main/1 Jupyter notebook doesn't print the link and I can't kill it, I need to kill the entire kernel. http://LT0PAR01056937:40000/dtale/main/1 Jupyter notebook 不打印链接,我无法杀死它,我需要杀死整个内核。
Thanks谢谢
I'm the main developer on D-Tale.我是 D-Tale 的主要开发者。 So I wonder if the D-Tale is not showing up within your notebook because it is being hosted from HTTPS but the D-TAle process is hosted from HTTP (which will cause a CORS exception)所以我想知道 D-Tale 是否没有显示在您的笔记本中,因为它是从 HTTPS 托管的,但 D-TAle 进程是从 HTTP 托管的(这会导致 CORS 异常)
Also, if you want to kill a D-tale process within your notebook without having the restart the notebook's kernel you can do the following.此外,如果您想在不重启笔记本内核的情况下终止笔记本中的 D-tale 进程,您可以执行以下操作。
dtale.instances()
# using any of the data ids that are printed from the previous command
# it will also print the URL of each piece of data you've loaded into D-Tale
dtale.get_instance([data_id]).kill()
Also, if your notebook isn't being served under HTTPS you can also try forcing the host to 'localhost' by using the following:此外,如果您的笔记本不在 HTTPS 下提供服务,您还可以尝试使用以下命令强制主机为“localhost”:
dtale.show(df, host='localhost')
Then maybe it can be reached from localhost.然后也许可以从本地主机访问它。 You can also try just killing the cell you kicked your D-tale process off from before having to kill the entire kernel.您也可以尝试在必须杀死整个内核之前杀死您踢掉 D-tale 进程的单元。 Hope this helps.希望这可以帮助。
In google colab, adding import dtale.app as dtale_app
works fine.在 google colab 中,添加import dtale.app as dtale_app
工作正常。
import pandas as pd
import dtale
import dtale.app as dtale_app
table = pd.DataFrame([[1, 2], [3, 4]], columns = ['a','b'])
d = dtale.show(table)
d
If you want to use in Google COlab then this code will help.如果您想在 Google COlab 中使用,那么此代码将有所帮助。
import pandas as pd
import dtale
import dtale.app as dtale_app
dtale_app.USE_COLAB = True
dtale.show(pd.DataFrame([1,2,3]))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.