V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
kevinfk2
V2EX  ›  Python

Python 怎么完成 excel 数据透析表的功能并输出汇总的表。

  •  
  •   kevinfk2 · Jan 28, 2021 · 2781 views
    This topic created in 1928 days ago, the information mentioned may be changed or developed.
    不然每次都要拖拽做透视表挺麻烦的。求 python 大神解答
    Supplement 1  ·  Jan 28, 2021
    目前想法是根据筛选的条件先做数据分组,然后求和填到新表中。
    Supplement 2  ·  Jan 29, 2021
    现在遇到一个问题是,汇总的 cloums 要用指定的日期范围作为列,不知道怎么整
    8 replies    2021-01-29 11:09:08 +08:00
    aydd2004
        1
    aydd2004  
       Jan 28, 2021 via iPhone   ❤️ 2
    pandas 我只能说这么多了
    kevinfk2
        2
    kevinfk2  
    OP
       Jan 28, 2021
    @aydd2004 有没有好的文章案例可以参考。小白只能靠临摹。我看到有 pandas 的 pivot_table 函数。没找到好的案例借鉴
    hackerang
        3
    hackerang  
       Jan 28, 2021
    @kevinfk2 搜索 pandas 教程, 找到你感兴趣的模块 跟着写就完了
    F281M6Dh8DXpD1g2
        4
    F281M6Dh8DXpD1g2  
       Jan 28, 2021
    数据透视表不就是分组求和.....
    venhal
        5
    venhal  
       Jan 29, 2021
    为什么我感觉 excel 拖拽比你用 python 写容易多了
    HelloViper
        6
    HelloViper  
       Jan 29, 2021
    .groupby().reset_index()
    princelai
        7
    princelai  
       Jan 29, 2021
    df.pivot_table(index=xxx,columns=xxx,values=xxx,aggfunc='xxx')

    哪个当索引,哪个当列,哪个是值,用什么函数聚合,官方教程上就有啊
    kevinfk2
        8
    kevinfk2  
    OP
       Jan 29, 2021
    @princelai 还有其他一些筛选的条件来汇总求和,在这上面难到了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 22:52 · PVG 06:52 · LAX 15:52 · JFK 18:52
    ♥ Do have faith in what you're doing.