Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- html
- github
- MacOS
- DoM
- DATAPATH
- architecture
- Pipelining
- DB
- web
- function
- while
- javascript
- mysql
- system
- control
- for
- instruction
- computer
- MIPS
- data structure
- react
- Java
- python
- XML
- php
- DS
- Class
- Algorithm
- Linux
- CSS
Archives
- Today
- Total
YYYEJI
[Python] Streamlit 본문
728x90
Streamlit 은
python으로 데이터 분석을 위한 웹앱을 쉽게 만들어주는 라이브러리입니다.
deploy방법이 쉬워서 누구나 쉽게 데모 웹을 만들 수 있습니다.
Streamlit을 사용하기 위해서는 Streamlit 라이브러리를 다운로드 해야되는데 conda에서 다운로드해서 사용하는게 좋습니다!
↓↓↓ Conda 사용하기 ↓↓↓
[Python] MacOS에서 Conda 사용하기
↓↓↓ 콘다 설치하기 위해서는 아래 링크로 들어가주세요 ↓↓↓ https://yyyeji.tistory.com/58 [Python] MacOS에서 Conda 설치하기 Conda 란 ? ? ? Anaconda는 파이썬 개발 환경을 쉽게 구축할 수 있도록 도와주
yyyeji.tistory.com
Conda가 실행된 환경에서 아래 코드를 실행해주세요.
pip install streamlit
pip install yfinance
↓↓↓ 잘 설치되었나 확인하고 싶으면 아래 코드를 터미널에 입력해주세요 ↓↓↓
streamlit hello
데모 페이지가 뜰겁니다!
파일을 실행시킬 때는 기존 터미널 명령과는 조금 다릅니다.
streamlit run p.py
먼저 완성된 화면부터 살펴보겠습니다.
import streamlit as st
import yfinance as yf
st.title("My First Web Application")
코드를 하나하나 살펴보겠습니다.
↓↓↓ streamlit와 yfinance를 import 해줘야 됩니다. ↓↓↓
import streamlit as st
import yfinance as yf
↓↓↓ 빈 화면에 title의 text가 출력됩니다. ↓↓↓
st.title("My First Web Application")
Header area 생성
st.header("Hi there~")
st.subheader("Welcome to My Blog")
Input text 생성
input_text = st.text_input(label="User Name", value="default value")
Button 생성
st.button("Click Me!")
Radio button 생성
radio_button = st.radio(label="Age group", options=["10", "20", "30", "40", "50"])
Check button 생성
check_button = st.checkbox(label="agree", value=False)
Text area 생성
text_area = st.text_area(label="memo", value="")
Selectbox 생성
st.selectbox("Which fruit?", ["Strawberry", "Banana", "Pineapple", "Orange"])
Multi Select 생성
st.multiselect("What else do you want?", ["Sugar", "Pepper", "Salt"])
Markdown 생성
st.markdown("""
Hello, **World** (Bold)
Hello _world_ (Italic)
- item1
- item2
- item3
1. number 1
2. number 2
""")
Slider 생성
st.slider("Level", 0, 10)
Input Box 생성
st.text_input("Email address")
st.date_input("Birthday date")
st.time_input("Birthday time")
st.text_area("Description")
st.file_uploader("Upload a photo")
◡̈
'Python' 카테고리의 다른 글
[Python] Jupyter notebook 사용법 (0) | 2023.03.24 |
---|---|
[Python] Streamlit 배포하기 (0) | 2022.11.24 |
[Python] Tkinter (0) | 2022.11.21 |
[Python] 예외처리 (0) | 2022.11.19 |
[Python] 파일 다루기 (2) | 2022.11.19 |