๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

์‹œ๊ฐํ™”5

pyecharts๋กœ ์‚ฐํฌ๋„ ๊ทธ๋ž˜ํ”„ ๊ทธ๋ฆฌ๊ธฐ ์•ˆ๋…•ํ•˜์„ธ์š” ํฌ๋ฆฌ๋„ฅ์Šค์„๋ผ์ด์Šค์ž…๋‹ˆ๋‹ค. ์˜ค๋Š˜์€ ๊ฐ„๋‹จํ•œ๊ฒŒ pyecharts ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด ์‚ฐํฌ๋„๋ฅผ ๋งŒ๋“ค์–ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ๋Š” 2022 ์‹œ์ฆŒ KBO ํŒ€์ˆœ์œ„๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋จผ์ œ ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค. # ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ import pandas as pd from pyecharts.charts import Bar, Line, Scatter from pyecharts import options as opts ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ์‚ฐํฌ๋„ ๊ทธ๋ž˜ํ”„๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. m = ( Scatter() .add_xaxis(list(kbo["ํŒ€๋ช…"])) # x๊ฐ’ -> ์ง์ ‘ ๊ฐ’์„ ์‚ฝ์ž… .add_yaxis("์Šน๋ฅ ", list(kbo["์Šน๋ฅ "])) # y๊ฐ’ .set_global_opts( title_opt.. 2023. 2. 12.
pyecharts๋กœ ํŒŒ์ด ๊ทธ๋ž˜ํ”„ ๊ทธ๋ฆฌ๊ธฐ ์•ˆ๋…•ํ•˜์„ธ์š” ํฌ๋ฆฌ๋„ฅ์Šค์„๋ผ์Šค์ž…๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ pyecharts ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ ํŒŒ์ด ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ ค๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉํ•  ๋ฐ์ดํ„ฐ๋Š” ๊ฐ€๋ณ๊ฒŒ ํ†ต์‹ ์‚ฌ๋ณ„ ์ ์œ ์œจ๋กœ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. # ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ from pyecharts import options as opts from pyecharts.charts import Pie # ํ†ต์‹ ์‚ฌ x = ["kt", "skt", "lg", "๊ธฐํƒ€"] # ์ ์œ ์œจ y = [35, 25, 25, 15] ํŒŒ์ด ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ฆฌ๊ธฐ ์ „์— ๋ฐ์ดํ„ฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ˜•ํƒœ๋กœ ๋งŒ๋“ค์–ด ์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. # ํŒŒ์ด ๊ทธ๋ž˜ํ”„์— ์‚ฌ์šฉ๋  ๋ฐ์ดํ„ฐ์…‹ z = [list(i) for i in zip(x, y)] ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ํ†ตํ•ด ํŒŒ์ด ๊ทธ๋ž˜ํ”„๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. p = ( Pie() .add("", z,) # ๋ฐ์ด.. 2023. 1. 29.
Pyecharts-์‚ฐ์ ๋„ ์‚ฐ์ ๋„(Scatter Plot)¶์˜ค๋Š˜์€ ์‚ฐ์ ๋„๋ฅผ ๊ทธ๋ ค๋ณผ๋ ค๊ณ  ํ•œ๋‹ค. In [40]: # ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๊ฐ€์ ธ์˜ค๊ธฐ import pandas as pd import pyecharts.options as opts from pyecharts.charts import Scatter ์ด๋ฒˆ์—๋Š” ๊ฐ€๋ณ๊ฒŒ ๊ทธ๋ ค๋ณผ ์˜ˆ์ •์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ์ดํ„ฐ๋Š” ์ž‘์€ ๊ฑธ๋กœ ๊ฐ€์ ธ์™”๋‹ค. ๋‚˜๋ฌด์œ„ํ‚ค(https://namu.wiki/w/2021%20LoL%20Champions%20Korea%20Spring)์—์„œ 2021๋…„ LCK Spring, Summer์˜ PoG ์ ์ˆ˜ ๋ฐ์ดํ„ฐ๋‹ค. ๋‚˜๋Š” ์—‘์…€์— ํ•˜๋‚˜ํ•˜๋‚˜ ์ ์—ˆ๋‹ค. In [3]: data = pd.read_excel("LCK_PoG.xlsx") In [4]: data Out[4]: Name Summer PoG .. 2021. 9. 1.
Pyecharts - ๋ง‰๋Œ€๊ทธ๋ž˜ํ”„ Pyecharts¶๊ตฌ๊ธ€์— Pyecharts๋ฅผ ๊ฒ€์ƒ‰ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ŠคํŽ€์ง€๋ฐฅ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. Pyecharts๋ฅผ ์ด์šฉํ•ด ๊ทธ๋ฆด ์ˆ˜ ์žˆ๋Š” ๊ทธ๋ž˜ํ”„๋“ค์ด ๊ถ๊ธˆํ•˜๋‹ค๋ฉด https://github.com/pyecharts/pyecharts-gallery ์ด๊ณณ์„ ๋ฐฉ๋ฌธํ•ด์„œ ์‚ดํŽด ๋ณด๋ฉด ๋œ๋‹ค. ์ด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ์ด์œ ๋Š” ๋‹จ์ˆœํ•˜๋‹ค. ๋‚˜์ค‘์— ์‰ฝ๊ฒŒ ๋ง‰๋Œ€ ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ฆฌ๊ณ  ์‹ถ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. In [ ]: # pyecharts ์„ค์น˜๋Š” ๋น„๊ต์  ์‰ฝ๋‹ค. !pip install pyecharts In [1]: # pyecharts ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ import pyecharts print("Pyecharts ๋ฒ„์ „ :", pyecharts.__version__) Pyecharts ๋ฒ„์ „ : 1.9.0 ๋จผ์ € ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ฆฌ๊ธฐ ์ „์— ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋Š” ํ†ต๊ณ„์ฒญ(h.. 2021. 8. 30.