목록Language/Python (22)
생각하는 감쟈
11일차 (23.03.27) 데이터 프레임의 데이터 조작import seaborn as snstitanic = sns.load_dataset("titanic")titanic.head() iris = sns.load_dataset("iris")iris titanic = sns.load_dataset("titanic",nrows=10)titanic.head() titanic["age"] 0 22.01 38.02 26.03 35.04 35.05 NaN6 54.07 2.08 27.09 14.0Name: age, dtype: float64 나이만 추출 titanic.loc[titanic.sex == "female", "age"] 1 38.02 ..

9 일차 (23.03.27) Pandas Seriesobj = pd.Series([2.-7,4,10])obj 0 -5.01 4.02 10.0dtype: float64 1차원 배열이 형태를 시리즈로 만들어줌 - key값 : value 값 obj.values array([-5., 4., 10.]) obj.index RangeIndex(start=0, stop=3, step=1) obj2 = pd.Series([2,-7, 4, 10], index = ['d','b','a','c'])obj2 d 2b -7a 4c 10dtype: int64 시리즈를 만들때 값 넘겨주고 인덱스 따로 넣어주기 obj2.index Index(['d', 'b', 'a', 'c'], ..
8일차 (23.03.22) 팬시인덱스 : 정수배열 인덱스인덱스 배열의 원소 각각이 원래 ndarray 객체 원소 하나를 가리키는 인덱스 정수여야함a= np.array([11,12,13,14,15,16,17,18,19])idx = np.array([0,2,4,6,8])a[idx] array([11, 13, 15, 17, 19]) idx = np.array([0,1,0,0,2,2,8])a[idx] array([11, 12, 11, 11, 13, 13, 19]) 매칭되는 인덱스 값을 집어 넣음 위치에 있는 값을 출력하겠다 a = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])a array([[ 1, 2, 3, 4], [ 5, 6, 7,..
7일차 (23.03.21) /Jupyter 실행 차이점)ctrl + enter : 출력은 나오는데 새로운 셀이 추가가 안됨alt + enter : 실행결과 나오면서 무조건 새로운 in[]셀이 추가됨shift + enter : 밑에 새롭게 셀이 추가 ,밑에 셀이 있을 경우 안 생김 이동만 됨셀 위치 변경 화살표로 이동 주석 처리 방법)cell - markdown : 주석 입력# ,## - # 사용할수록 글씨 작아짐> - 들여쓰기(?)tap - NUmPy(Numerical Python)1 제공빠르고 효율적인 다차원 배열 객체 ndarray배열 원소를 다루거나 배열 간의 수학 계산을 수행하는 함수디스크로부터 배열 기반의 데이터를 읽거나 쓸수 있는 도구파이썬 확장과 c, c++ 코드에서 Numpy의 자료구조에..

6일차 (23.03.20) '''타자게임'''import randomimport timedef play_game(): f = open("words.txt","r",encoding="utf-8") w = f.readlines() w = [line.rstrip('\n') for line in w] #\n 제거 number = 1 # 문제 넘버 count = 0 # 맞춘 문제 카운트 print("[타자 게임] 준비되면 엔터! 종료하고 싶으면 exit입력히세요.") input() # ENTER 시작 start_time=time.time() # 시간 시작 while True: question=random.choice(w) #단어 중 랜덤 선택(q..

코딩 드럽게 못하는 코린이는 바짓가랑이라도 잡고 열심히 연습해야한답니다 Chapter 02 기본 문법 ''' c2-1 연월일 사이에 '입력 ''' year = input("년은 ?") month = input("월은 ?") day = input("일은 ?") print(year, month, day, sep=".") ''' c2-2 사각형의 둘레와 면적을 계산 ''' width = int(input("사각형의 너비는?")) hight = int(input("사각형의 높이는?")) lenght = 2 * width * hight area = width * hight print ("사각형의 넓이:%dcm" % width) print ("사각형의 높이:%dcm" % hight) print ("둘레길이 : %d..