一、PandasGUI简介

Pandasgui为pandas创建了一个GUI界面,我们可以在其中使用pandas的功能分析数据和使用不同的功能,以便可视化和分析数据,并执行探索性数据分析。
官网地址:https://github.com/adamerose/PandasGUI
在这里插入图片描述
安装方法
在这里插入图片描述
使用说明
在这里插入图片描述
功能简介
在这里插入图片描述
其他说明
在这里插入图片描述

二、下载安装

依赖有点多,建议利用国内源下载

pip install -i https://pypi.douban.com/simple pandasgui
(env_study) PS E:\python_study\env_study> pip install -i https://pypi.douban.com/simple pandasgui
Looking in indexes: https://pypi.douban.com/simple
Collecting pandasgui
  Downloading https://pypi.doubanio.com/packages/70/60/dfbe9817d621bb6868427283273e17c1209d0c5b763106a75acccd44ebda/pandasgui-0.2.13.tar.gz (215 kB)
     |████████████████████████████████| 215 kB 285 kB/s
Requirement already satisfied: pandas in e:\python_study\env_study\lib\site-packages (from pandasgui) (1.3.1)
Requirement already satisfied: numpy in e:\python_study\env_study\lib\site-packages (from pandasgui) (1.21.1)
Requirement already satisfied: PyQt5 in e:\python_study\env_study\lib\site-packages (from pandasgui) (5.15.4)
Requirement already satisfied: PyQt5-sip in e:\python_study\env_study\lib\site-packages (from pandasgui) (12.9.0)
Collecting PyQtWebEngine
  Downloading https://pypi.doubanio.com/packages/2d/f7/624ebcd03ce03287d017d7ec586c51c95212e0cd5904df15fa3215aa91b6/PyQtWebEngine-5.15.4-cp36.cp37.cp38.cp39-none-win_amd64.whl
 (182 kB)
     |████████████████████████████████| 182 kB 177 kB/s
Requirement already satisfied: plotly in e:\python_study\env_study\lib\site-packages (from pandasgui) (5.1.0)
Collecting wordcloud
  Downloading https://pypi.doubanio.com/packages/be/33/5bdd39587f0e8ede3fe12d9d16d6f1fb5e7a43f29621604a949ee362d013/wordcloud-1.8.1.tar.gz (220 kB)
     |████████████████████████████████| 220 kB 504 kB/s
Requirement already satisfied: setuptools in e:\python_study\env_study\lib\site-packages (from pandasgui) (57.1.0)
Collecting appdirs
  Downloading https://pypi.doubanio.com/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: pynput in e:\python_study\env_study\lib\site-packages (from pandasgui) (1.7.3)
Collecting IPython
  Downloading https://pypi.doubanio.com/packages/76/d1/e6166fc278a0aab9c2997ae241346837368fc9aa0c6eea9b0dbe2d727004/ipython-7.28.0-py3-none-any.whl (788 kB)
     |████████████████████████████████| 788 kB 501 kB/s
Collecting pyarrow
  Downloading https://pypi.doubanio.com/packages/c2/34/a45df90ac2bb9c5565cfa65f7bc9875b5eedf3a84a22af1f013d8c5d7097/pyarrow-5.0.0-cp39-cp39-win_amd64.whl (14.5 MB)
     |████████████████████████████████| 14.5 MB 2.2 MB/s
Collecting astor
  Downloading https://pypi.doubanio.com/packages/c3/88/97eef84f48fa04fbd6750e62dcceafba6c63c81b7ac1420856c8dcc0a3f9/astor-0.8.1-py2.py3-none-any.whl (27 kB)
Collecting typing-extensions
  Downloading https://pypi.doubanio.com/packages/74/60/18783336cc7fcdd95dae91d73477830aa53f5d3181ae4fe20491d7fc3199/typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting qtstylish>=0.1.2
  Downloading https://pypi.doubanio.com/packages/b5/b6/77b24a0111fbfa7f1822c70070c91f0f00fcda696f35ecc13e806e0ac54d/qtstylish-0.1.5.tar.gz (983 kB)
     |████████████████████████████████| 983 kB 939 kB/s
Collecting traitlets>=4.2
  Downloading https://pypi.doubanio.com/packages/38/4c/466298b114eea62f300dbef98cc2c33c6cbc439f1f71bc199c674ae23c2c/traitlets-5.1.0-py3-none-any.whl (101 kB)
     |████████████████████████████████| 101 kB 1.1 MB/s
Collecting pygments
  Downloading https://pypi.doubanio.com/packages/78/c8/8d9be2f72d8f465461f22b5f199c04f7ada933add4dae6e2468133c17471/Pygments-2.10.0-py3-none-any.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 595 kB/s
Collecting jedi>=0.16
  Downloading https://pypi.doubanio.com/packages/f9/36/7aa67ae2663025b49e8426ead0bad983fee1b73f472536e9790655da0277/jedi-0.18.0-py2.py3-none-any.whl (1.4 MB)
     |████████████████████████████████| 1.4 MB 652 kB/s
Collecting pickleshare
  Downloading https://pypi.doubanio.com/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting matplotlib-inline
  Downloading https://pypi.doubanio.com/packages/a6/2d/2230afd570c70074e80fd06857ba2bdc5f10c055bd9125665fe276fadb67/matplotlib_inline-0.1.3-py3-none-any.whl (8.2 kB)
Requirement already satisfied: colorama in e:\python_study\env_study\lib\site-packages (from IPython->pandasgui) (0.4.4)
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Downloading https://pypi.doubanio.com/packages/c6/37/ec72228971dbaf191243b8ee383c6a3834b5cde23daab066dfbfbbd5438b/prompt_toolkit-3.0.20-py3-none-any.whl (370 kB)
     |████████████████████████████████| 370 kB 1.3 MB/s
Collecting backcall
  Downloading https://pypi.doubanio.com/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting decorator
  Downloading https://pypi.doubanio.com/packages/3d/cc/d7b758e54779f7e465179427de7e78c601d3330d6c411ea7ba9ae2f38102/decorator-5.1.0-py3-none-any.whl (9.1 kB)
Collecting parso<0.9.0,>=0.8.0
  Downloading https://pypi.doubanio.com/packages/a9/c4/d5476373088c120ffed82f34c74b266ccae31a68d665b837354d4d8dc8be/parso-0.8.2-py2.py3-none-any.whl (94 kB)
     |████████████████████████████████| 94 kB 1.1 MB/s
Requirement already satisfied: wcwidth in e:\python_study\env_study\lib\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->IPython->pandasgui) (0.2.5)
Requirement already satisfied: python-dateutil>=2.7.3 in e:\python_study\env_study\lib\site-packages (from pandas->pandasgui) (2.8.2)
Requirement already satisfied: pytz>=2017.3 in e:\python_study\env_study\lib\site-packages (from pandas->pandasgui) (2021.1)
Requirement already satisfied: six>=1.5 in e:\python_study\env_study\lib\site-packages (from python-dateutil>=2.7.3->pandas->pandasgui) (1.16.0)
Requirement already satisfied: tenacity>=6.2.0 in e:\python_study\env_study\lib\site-packages (from plotly->pandasgui) (8.0.1)
Requirement already satisfied: PyQt5-Qt5>=5.15 in e:\python_study\env_study\lib\site-packages (from PyQt5->pandasgui) (5.15.2)
Collecting PyQtWebEngine-Qt5>=5.15
  Downloading https://pypi.doubanio.com/packages/e0/db/0f29bd882aee8b5754f3e1ab104d2d09cdd9138a889558b43badcd81ce11/PyQtWebEngine_Qt5-5.15.2-py3-none-win_amd64.whl (60.0 MB)
     |████████████████████████████████| 60.0 MB 1.6 MB/s
Requirement already satisfied: pillow in e:\python_study\env_study\lib\site-packages (from wordcloud->pandasgui) (8.3.1)
Requirement already satisfied: matplotlib in e:\python_study\env_study\lib\site-packages (from wordcloud->pandasgui) (3.4.2)
Requirement already satisfied: pyparsing>=2.2.1 in e:\python_study\env_study\lib\site-packages (from matplotlib->wordcloud->pandasgui) (2.4.7)
Requirement already satisfied: cycler>=0.10 in e:\python_study\env_study\lib\site-packages (from matplotlib->wordcloud->pandasgui) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in e:\python_study\env_study\lib\site-packages (from matplotlib->wordcloud->pandasgui) (1.3.1)
Building wheels for collected packages: pandasgui, qtstylish, wordcloud
  Building wheel for pandasgui (setup.py) ... done
  Created wheel for pandasgui: filename=pandasgui-0.2.13-py3-none-any.whl size=233725 sha256=64f5d850ba6cac8d2d510ee1ba58441974e48ad96b7db92dce1b679718dff0ad
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\42\e3\29\f3c748ebd0327ddc1c0f9a54f7747ac48f10125435dd8334ce
  Building wheel for qtstylish (setup.py) ... done
  Created wheel for qtstylish: filename=qtstylish-0.1.5-py3-none-any.whl size=1029285 sha256=3f6dca6153389fe26f6cf8e59d1adfbae6394a03447282a3e7bd2a2ad5dc8a14
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\ac\60\21\2adfa6e056d94dd686ab9165e3d61c6c589ef00bf9ad252952
  Building wheel for wordcloud (setup.py) ... done
  Created wheel for wordcloud: filename=wordcloud-1.8.1-cp39-cp39-win_amd64.whl size=154800 sha256=4d12b8f009520f8864b4ead3619d62965dbf34a5f789c65f65416ee55626c01f
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\bc\9f\d5\7c5937d1f37c9a6607fdd1709263669b801c1555226371adc0
Successfully built pandasgui qtstylish wordcloud
Installing collected packages: traitlets, parso, PyQtWebEngine-Qt5, pygments, prompt-toolkit, pickleshare, matplotlib-inline, jedi, decorator, backcall, wordcloud, typing-exte
nsions, qtstylish, PyQtWebEngine, pyarrow, IPython, astor, appdirs, pandasgui
Successfully installed IPython-7.28.0 PyQtWebEngine-5.15.4 PyQtWebEngine-Qt5-5.15.2 appdirs-1.4.4 astor-0.8.1 backcall-0.2.0 decorator-5.1.0 jedi-0.18.0 matplotlib-inline-0.1.
3 pandasgui-0.2.13 parso-0.8.2 pickleshare-0.7.5 prompt-toolkit-3.0.20 pyarrow-5.0.0 pygments-2.10.0 qtstylish-0.1.5 traitlets-5.1.0 typing-extensions-3.10.0.2 wordcloud-1.8.1

(env_study) PS E:\python_study\env_study>

三、PandasGUI官网实例

3.1 官网实例导入

在这里插入图片描述

3.2 静态统计

在这里插入图片描述

3.3 条件过滤

在这里插入图片描述

3.4 图表可视化

在这里插入图片描述

3.5 数据reshape

在这里插入图片描述

四、Covid-19数据展示

4.1 数据集介绍

2019-2020年世界Covid-19数据,近23万行,42列
在这里插入图片描述

4.2 数据提取与准备

import pandas as pd
from pandasgui import show
import os
import datetime


# 分块
chunks = pd.read_csv("../data/covid-19.csv", chunksize=10000)   # 生成一个文本读取器,并没有真正去读文件

total = 0
file = "../data/result_分块分列.csv"
if os.path.exists(file):
    os.remove(file)

for i, df in enumerate(chunks):
    # 处理空值:删除全为空值的列
    df.dropna(how="all", inplace=True, axis=1)
    result = []
    # 拿到有用列
    df = df[['date', 'country', 'countryCode', 'confirmed']]
    for a, b, c, d in df.values:
        if not isinstance(a, str):  # 如果data不是str类型,就抛弃本行数据
            continue
        # 提取指定年月的数据
        if a.split("-")[0] == '2020' and 1 <= int(a.split("-")[1]) <= 8:
            result.append((*a.split("-"), b, d))      # 结果为 [()],生成df时,元组列表常用
            total += 1

    df = pd.DataFrame(result, columns=["年", "月", "日", "国家", "数量"])
    df.to_csv(file, index=False, mode='a', header=not os.path.exists(file), encoding="utf-8")

df = pd.read_csv(file, converters={'年': str, '月': str, '日': str})
show(df)

4.3 可视化分析界面

  1. 数据框页面
    在这里插入图片描述

  2. 静态数据统计
    在这里插入图片描述

  3. 数据可视化
    在这里插入图片描述

  4. 可视化代码导出
    在这里插入图片描述

  5. 图表保存为png图片
    在这里插入图片描述

  6. 导出的图片
    在这里插入图片描述

  7. 查看关键参数
    在这里插入图片描述

  8. 折线图
    在这里插入图片描述

  9. 条形图
    在这里插入图片描述

  10. 箱型图
    在这里插入图片描述

  11. 小提琴图
    在这里插入图片描述

  12. 3D散点图
    在这里插入图片描述

  13. 热力图
    在这里插入图片描述

  14. 等高线图
    在这里插入图片描述

  15. 饼图
    在这里插入图片描述

  16. 散点图矩阵
    在这里插入图片描述

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐