์ํฌํธํ๋ค.
python
๋ซ๊ธฐimport streamlit as st
import pandas as pd
from PIL import Image # ํ์ด์ฌ ์ด๋ฏธ์ง ๋ผ์ด๋ธ๋ฌ๋ฆฌ PIL
import FinanceDataReader as fdr #์ฌ์ฉํ ์ฃผ์๋ฐ์ดํฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ด๋ค.
๊ตญ๋ด ์ฃผ์๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์์, df์ ์ ์ฅํ๋ค.
python
๋ซ๊ธฐdf = fdr.StockListing("KRX")
ํ๋ฉด ์ ์ฒด์ ๊ฐ์ด๋ฐ ์ ๋ ฌ์ ์ํด col2์ ์ฝ๋๋ฅผ ์งฐ๋ค.
์ ์ฒด๋ฐ์ดํฐ ๋ณด๊ธฐ๋ st.button()์ ์ฌ์ฉํ์๋ค.
python
๋ซ๊ธฐdef run_view() :
โโโโ
โโโโcol1, col2, col3 = st.columns([1, 2.5, 1]) # ํ๋ฉด์ ๊ฐ์ด๋ฐ ์ ๋ ฌ์ ์ํด ์ฌ์ฉํจ
โโโโ
โโโโwith col2 :
โโโโโโโโst.title('โ
. ์ฃผ์์ ๋ณด ๋ณด๊ธฐ')
โโโโโโโโst.header(' : Viewing stock information')
โโโโโโโโst.subheader('')
โโโโโโโโst.text('์ฃผ์์ ๊ฒ์ํ์ฌ ์ ๋ณด๋ฅผ dataset์ผ๋ก ๋ถ๋ฌ์ต๋๋ค')
โโโโโโโโst.text('๊ธฐ์
์ Code๋ ์ฃผ์ ์์ธก ๋๊ตฌ์์ ์ฌ์ฉํ๋ฏ๋ก ์ฃผ์๊ฐ์น ์์ธก์ ์ํ๋ฉด Code๋ฅผ ๋ณต์ฌํด์ฃผ์ธ์')
โโโโโโโโst.header('')
โโโโโโโโ# ์ ์ฒด ๋ฐ์ดํฐ๋ณด๊ธฐ
โโโโโโโโif st.button(label='์ ์ฒด ๋ฐ์ดํฐ๋ณด๊ธฐ') :
โโโโโโโโโโโโst.dataframe(df, width=2000, height=550)
โโโโโโโโ
โโโโโโโโst.header('')
โโโโโโโโst.subheader('์ปฌ๋ผ(columns)์ ๋ํ ์ค๋ช
์
๋๋ค')
โโโโโโโโ
โโโโโโโโ# ์ปฌ๋ผ ์ค๋ช
์ ๋ํ ์ด๋ฏธ์ง
โโโโโโโโimg = Image.open('./view_column.png')
โโโโโโโโst.image(img, width=800)
โโโโโโโโ
โโโโโโโโst.header('')


์ปฌ๋ผ์ ๋ํ ์ค๋ช ์ ์ด๋ฏธ์ง๋ก ๋ง๋ค์ด์ ํ๋ฉด์ ํ์ํ์๋ค.

๋ฐ์ดํฐ ๊ฒ์ํ๋ฉด ๋ฐ์ดํฐํ๋ ์ ์ถ๋ ฅํ๊ฒํ๊ธฐ
python
๋ซ๊ธฐโ# ๋ฐ์ดํฐ ๊ฒ์ํ๋ฉด ๋ฐ์ดํฐํ๋ ์ ์ถ๋ ฅํ๊ฒํ๊ธฐ
โโโโnew_data = st.text_input('์ฃผ์์ Name์ ์
๋ ฅํด์ฃผ์ธ์ ex)์ผ์ฑ, ํ๋')
โโโโst.dataframe(df.loc[df['Name'].str.contains(new_data)], width=2000, height=450)
