Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- kafka
- mysql
- spring boot
- CDC
- 동적 차트
- 윈도우
- k9s
- DBT
- Materializations
- Java
- dbt_project
- spark
- numpartitions
- 카프카
- polars
- UI for kafka
- 크롤링
- bar cahrt
- ksql
- freshness
- Python
- query history
- KubernetesPodOperator
- proerty
- docker
- airflow
- 모바일
- 도커
- 파이썬
- 쿠버네티스
Archives
- Today
- Total
데이터 엔지니어 이것저것
bar_chart_race 본문
728x90
파이썬으로 심플하게 동적 차트를 그리기 위해 사용
pip install bar_chart_race
추가적으로 이렇게 하면 과거 버전이고, 가장 최신버전은 pip에서 안된다.
pip uninstall bar_chart_race
pip install git+https://github.com/dexplo/bar_chart_race
결과물을 영상으로 저장하기 위해서는 FFMPEG가 필요하다
프로그램 설치 : https://www.gyan.dev/ffmpeg/builds/
Builds - CODEX FFMPEG @ gyan.dev
FFmpeg is a widely-used cross-platform multimedia framework which can process almost all common and many uncommon media formats. It has over 1000 internal components to capture, decode, encode, modify, combine, stream media, and it can make use of dozens o
www.gyan.dev
시스템 환경 변수에 추가
코드 실행 결과물
sample code
import pandas as pd
import bar_chart_race as bcr
df = pd.read_csv('data/premierLeague_tables_1992-2017.csv')
df = df[['season', 'team', 'points']]
df = df.pivot_table(values='points', index=['season'], columns='team')
df.fillna(0, inplace=True)
df.sort_values(list(df.columns), inplace=True)
df = df.sort_index()
df.iloc[:, 0:-1] = df.iloc[:, 0:-1].cumsum()
top_prem_clubs = set()
for index, row in df.iterrows():
top_prem_clubs |= set(row[row > 0].sort_values(ascending=False).head(6).index)
df = df[list(top_prem_clubs)]
bcr.bar_chart_race(df=df,
n_bars=6,
sort='desc',
title='Premier League Clubs Points Since 1992',
filename='pl_clubs.mp4')
Bar Chart Race - premier league
Explore and run machine learning code with Kaggle Notebooks | Using data from Premier League 1992-2017
www.kaggle.com
728x90
'기타 > 데이터 분석 및 시각화' 카테고리의 다른 글
ydata profiling (0) | 2023.11.10 |
---|---|
python plot 한글 깨짐 (0) | 2023.10.25 |
Lux (0) | 2021.11.18 |
타이타닉 분석 (0) | 2021.09.11 |
판다스 프로파일링 (0) | 2021.09.09 |