| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 | 30 | 31 |
- NER
- TFX
- cross domain
- RNN
- BERT
- Ann
- MLOps
- stemming
- Binary classification
- gaze estimation
- Logistic Regression
- Transfer Learning
- nlp
- Python
- NMF
- AI 윤리
- Gradient Descent
- VGGNet
- Attention
- 자기조직화지도
- textmining
- tensorflow
- LSTM
- Generative model
- 경사하강법
- Clustering
- Support Vector Machine
- 군집화
- SOMs
- ResNet
- Today
- Total
목록python (8)
juooo1117
두 개 이상의 dataframe을 합쳐서 하나로 만드는 방법을 알아보자 1. pd.concat() - 수직/수평 결합을 모두 지원 pd.concat([df1, df2, ... ], keys=[], axis=0, join='outer') axis = 0 : 수직결합 & axis = 1 : 수평결합 join = 'outer' : full outer join & join = 'inner' : 동일한 index,column 이름끼리 합침 # 합칠 때 index이름은 무시(버림) stocks = pd.concat([stock_2016, stock_2017, stock_2018], ignore_index=True) # 합친 각 dataframe을 구분할 수 있도록 index 추가 stocks = pd.concat(..
원하는 조건을 데이터를 조회하고 일괄적으로 처리하는 방법에 대해 정리해 보자 1. 데이터 조회 - filter() # 'Age'의 평균이 20이상이면 return! def check_mean(data): return data['Age'].mean() >= 20 # 'Country' 별 'Age'의 평균이 20이상인 값 조회 df.groupyby('Country').filter(check_mean) # 'col_name'과 'threshold'를 입력으로 받음 def check_mean2(data, col_name, threshold): return data[col_name].mean() >= threshold df.groupby('Country').filter(check_mean2, col_name='A..
데이터를 불러와서 정렬하고 일정한 조건으로 집계해 보자. 1. 데이터 정렬 df.sort_index() # 오름차순 정렬 df.sort_index(ascending=False) # 내림차순 정렬 df.sort_index(axis=1) # column 이름을 기준으로 정렬 df.sort_index().loc['A':'B'] # A로 시작하는 값들만 조회('B'는 포함아님) df.sort_values(by='Country') # Country를 기준으로 오름차순 정렬 df.sort_values(by='Country', ascending=False) # 내림차순 정렬 df.sort_values(['Country','Region'], ascending=[True, False])[['Country','Region..
데이터를 불러와서 만질 때 가장 많이 쓰이는 pandas에 대해서 정리하고자 한다. 기본적으로 가장 자주 쓰이는 것들을 정리해 보자 1. .csv 데이터 불러오기 df = pd.read.csv('/data/grade3.csv', header=None, # 원래는 첫 행이 header가 된다. names=['ID','국어','영어'] # column명을 정해준다. na_values=['없음', '미정', '탈락'] # '없음','미정','탈락' 3가지 값이 NaN 이 된다. ) df.isnull().sum() # column별로 null인 값이 몇개인지 확인 df = pd.read.csv('/data/grade3.csv', index_col=0 # 0번 column을 index로 사용 ) df = pd.r..
Comprehension 결과를 넣을 새로운 자료구조에 따라 다음 세가지 구문 존재 리스트 컴프리헨션 딕셔너리 컴프리헨션 셋 컴프리헨션 l1 = [1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4] # list comprehension result2 = [(i * 10) for i in l1] print(result2) #결과: [10, 20, 30, 40, 50, 60, 70, 10, 20, 30, 40] # set comprehension, 중복값 제거할 때 result3 = {(i *10) for i in l1} print(result3) #결과: {70, 40, 10, 50, 20, 60, 30} # dictionary comprehension, {key-처리한 값의 index / valu..
if문 if 조건(1): 명령문 elif 조건(2): 명령문 ... else: 명령문 # 공백을 인정해주고 싶지 않을때 -> 공백제거 .strip()사용 txt = input("text를 입력하세요: ") if txt.strip(): print("입력한 text: ", txt) else: print("입력을 해야합니다.") num = int(input("양수입력: ")) if num >= 100000: print("아주커요") elif num >= 1000: print("커요") elif num >= 100: print("보통이에요") elif num >= 0: print("작아요") while문 while 조건: 반복구문 ... limit = int(input("반복횟수: ")) count = 0 if..
List: 순서있음, 중복값허용, 원소변경가능 Tuple: 순서있음, 중복값허용, 원소변경불가 Dictionary: Key-Value 형태로 저장 Set: 순서없음, 중복값불가 List list_1[0] = 100 #list값 변경 del list_1[0] #list의 해당 인덱스값 삭제 list_1.append(60) #list 마지막 인덱스에 추가 # 중첩리스트 list1.append(list2) # 결과: [1, 2, 3, [10, 20, 30]] .append() .extend() .sort([reverse=False]) .insert(index, 삽입할 값) .remove(삭제할 값) list = [1, 2, 3, 4, 5, 6, 7] list.append(10) #list에 바로 추가 list..
# in, not in string1 = "juooo1117" value1 = 'o' in string1 #문자열 'o'가 string1에 있으면 True, 없으면 False 반환 value2 = 'o' not in string1 #없으면 True, 있으면 False 반환 print(value1, value2) # fruits에 '수박'이 있는지 확인하기 위함 fruits = "사과 복숭아 귤 배 수박" "수박 있음" if "수박" in fruits else "수박 없음" # slicing 문자열[시작index : 종료index : 간격] string2 = "0123456789" print(string2[3:8:2]) #2씩증가 / 357 print(string2[:7:3]) #처음부터, 3씩증가 / 0..