Загрузка страницы

How to make grouped bar charts in pandas/Python with crosstab and pivot tables and more

Building grouped bar charts in pandas can be a pain, since you need to understand how .plot() and matplotlib work *AND* get your data formatted correctly first. This video explains how .plot() works, what columns/rows do when plotting, and how to reshape or reorganize your data into a grouped-bar-chart-friendly format - we look at pivot_table, groupby + value_counts + reset_index or unstack, and crosstab. Not in-depth, but probably enough to tackle what you're trying to do!

Completed code: https://gist.github.com/jsoma/4654e706a8af61d71b7055304824fa50

Other recommended graphing libraries:
Altair: https://altair-viz.github.io/
Seaborn: https://seaborn.pydata.org/index.html

If you're asking yourself "why are there so many bold words for index names or columns??" or "why did he have to do y='count' in that one spot???" I recommended giving a read about MultiIndexes: https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html

Видео How to make grouped bar charts in pandas/Python with crosstab and pivot tables and more канала Jonathan Soma
Показать
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки