본문 바로가기

반치용/기타 및 저장74

[파이썬]random matrix 만드는 코드 mat = [[random.choice(range(10)) for _ in range(18)] for _ in range(18)] 0~9 사이의 값으로 된 18 x 18 사이즈의 매트릭스 만들기 2020. 6. 18.
[R]xgboost 코드 (iris) library(xgboost) data(iris) # Convert the Species factor to an integer class starting at 0 # This is picky, but it's a requirement for XGBoost species = iris$Species label = as.integer(iris$Species)-1 iris$Species = NULL n = nrow(iris) train.index = sample(n,floor(0.75*n)) train.data = as.matrix(iris[train.index,]) train.label = label[train.index] test.data = as.matrix(iris[-train.index,]) test... 2020. 6. 18.
[파이썬]글 내의 단어 빈도 체크 count = {} # 딕셔너리 생성 for j in open('jupytorNotebooks/poet.txt').read().replace("\n","").replace(".","").split() : count[j] = count.get(j,0) + 1 # items 생성 [(x,y) for (y,x) in sorted([(x, y) for (y, x) in count.items()], reverse=True)[:11]] # 정렬 쓸 데 없는 집착이긴 한데, 더 줄일 방법이 있을까? count = {} # 딕셔너리 생성 for j in "apple apple monkey snail apple monkey chiken".replace("\n","").replace(".","").split() : cou.. 2020. 6. 17.
[파이썬]열쇠 모양 만들기 Ban's Key def factorials(n): if n ==1 : return 1 else: return n*factorials(n-1) base_key = [1,11,11,5,7,30,30,19,21,60] a = list( range(base_key[0],base_key[1])) + list( range(base_key[2],base_key[3],-1)) + list( range(base_key[4],base_key[5])) + list( range(base_key[6],base_key[7],-1)) + list( range(base_key[8],base_key[9])) for i in a: print(("{0:^105}".format(factorials(i)).replace("0",""))[4.. 2020. 6. 17.
[저장]파이썬 문자열 문장 단위 문자열 나누기 너무 자주 쓰는건데, 문장별로 나눈 후 온점 붙이는 코드입니다. a = "앨리스는 갔다. 이상한 나라로. 돌아왔다".split(".") if (a[-1] == '') or a[-1] == ' ': del(a[-1]) a=[i+"." for i in a] a 2020. 6. 16.
[react/django] 관련 저장 장고걸스 학습 내용 http://milooy.github.io/TIL/ Today Yurim Learned milooy.github.io react / django 를 이용한 pwa https://www.slideshare.net/jayjin0427/progressive-web-app-feat-react-django-82499585 Progressive Web App (feat. React, Django) 2017 DevFest에서 PWA(Progressive Web App)에 대해 발표한 자료입니다. www.slideshare.net 토이프로젝트 깃허브? https://github.com/milooy/react-django-pwa-kit 2020. 6. 2.