1、其他
1.1 代码测试
(1)两种启动 D-Tale 的方式:
- 将DataFrame对象传递给 D-Tale 函数,在 Jupyter 单元中实例化 GUI。
- 不导入DataFrame对象的情况下初始化 D-Tale,显示为一个带有 GUI 的交互菜单来加载数据并提供各种其他选项。
import dtale
dtale.show(open_browser=True)
import dtale
import pandas as pd
if __name__ == '__main__':
dtale.show(pd.DataFrame([1,2,3,4,5]), subprocess=False)
(2)数据的导入有几种方式:
- 从文件加载数据
- 从网站加载数据。需要传递网站的链接,可以从中获取 CSV、JSON、TSV 或 Excel 等文件。
- 加载示例数据集。这些数据集可能需要一些后台下载才能从服务器获取数据集。
1.2 Running tests
#The usual npm test command works:
npm test
#You can run individual test files:
npm run test -- static/__tests__/dtale/DataViewer-base-test.jsx
1.3 Linting
使用 npm run lint 校验代码的编码规范。
# You can lint all the JS and CSS to confirm there's nothing obviously wrong with it:
$ npm run lint
# You can also lint individual JS files:
$ npm run lint-js-file -s -- static/dtale/DataViewer.jsx
1.4 Formatting JS
# You can auto-format code as follows
$ npm run format
1.5 Adding Language Support
目前D-Tale同时支持英文和中文,但其他语言也很乐意得到支持。要添加另一种语言,只需打开包含以下内容的拉取请求:
- 复制并翻译以下JSON英语JSON文件中的值,并将它们保存到与每个文件相同的位置。
- 请将这些文件的名称设置为您要添加的语言的名称(当前为英文-> en,中文-> cn)
- 请务必保留英文key,这很重要。
1.6 Global State/Data Storage
如果D-Tale在具有多个python进程的环境中运行(例如:在运行gunicorn的Web服务器上),则很可能会遇到状态不一致的问题。开发人员可以通过配置 D-Tale 用于存储数据的系统来解决此问题。详细文档可在此处获得:数据存储和管理全局状态。
2、dtale-desktop
Build a data visualization dashboard with simple snippets of python code
前端是用 react 编写的,混合了 ant 设计和样式组件。
后端是用python编写的,它实际上由两个应用程序组成,它们侦听不同的端口。主要的是一个异步 FastAPI 应用程序,它负责与仪表板通信、与文件系统交互以及执行用户定义的代码来获取/转换数据。它可以通过将提交的代码保存为持久文件,然后使用 importlib.util 构建然后导入生成的模块来做到这一点。第二个应用程序用于运行 dtale 实例,它是一个同步烧瓶应用程序。
https://pypi.org/project/dtaledesktop/
https://openbase.com/python/dtaledesktop
2.1 直接安装
pip install dtaledesktop
2.2 运行
Running it from the command line:
dtaledesktop
自动启动浏览器,然后打开网址127.0.0.1:xxxx。
鼠标点击网址页面中的Table按钮,弹出如下的页面。
鼠标点击网址页面中的Correlation按钮,弹出如下的页面。
Running it from a python script:
import dtale_desktop
dtale_desktop.run()
2.3 代码编译
First, you'll want to clone the repo and install the python dependencies:
$ git clone https://github.com/phillipdupuis/dtale-desktop.git
$ cd dtale-desktop
$ python setup.py develop
Then you'll need to install the javascript dependencies and build the react app:
$ cd dtale_desktop/frontend
$ npm install
$ npm run build
And now you should be able to launch it like so:
$ python dtale_desktop/app.py
结语
如果您觉得该方法或代码有一点点用处,可以给作者点个赞,或打赏杯咖啡;
╮( ̄▽ ̄)╭
如果您感觉方法或代码不咋地
//(ㄒoㄒ)//,就在评论处留言,作者继续改进;
o_O???
如果您需要相关功能的代码定制化开发,可以留言私信作者;
(✿◡‿◡)
感谢各位大佬童鞋们的支持!
( ´ ▽´ )ノ ( ´ ▽´)っ!!!