Pandas 행과 열의 문자열인덱스를 숫자로 가져오는 방법
# pandas 문자열로 된 인덱스를 숫자로 가져오는방법 # Create a sample dataframe df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9]}, index=['a', 'b', 'c']) # Find the index number of label 'b' index_number = df.index.get_loc('b') print(index_number) # Output: 1 # pandas 문자열로 된 컬럼을 숫자로 가져오는방법 # Create a sample dataframe df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9]}) # Find the ind..
2022. 12. 16.
Streamlit 웹대시보드 이미지,동영상,title, button, text, dataframe, multiselect, slider
위의 그림과 무관하게 테스트 코드를 작성하였으니 직접 실행해보면서 테스트 하기를 바람. import streamlit as st import pandas as pd # UI 요소들을 처리하는 방법 # 버튼, 라디오버튼, 셀렉트박스, 멀티셀렉트, 슬라이더 def main() : df = pd.read_csv('streamlit_data/iris.csv') # 버튼을 클릭하면, 데이터프레임이 보이도록 만들기. if st.button('데이터프레임 보기') : st.dataframe(df) name = 'Mike' if st.button('대문자로') : st.text(name.upper()) if st.button('소문자로') : st.text(name.lower()) status = st.radio('정..
2022. 12. 12.