프로그래밍
-
🤖 Django 웹 프레임워크프로그래밍/Django & Flask 2020. 10. 24. 13:59
Django 웹 프레임워크 📌 일반적인 특징 MVC 패턴 기반 MTV - 장고에서는 View를 Template, Controller를 View라고 부른다. 객체 관계 매핑(Object-Relational Mapping) - 데이터베이스 시스템과 데이터 모델을 연결시키는 다리와 같은 역할 자동으로 구성되는 관리자 화면 - 장고는 웹 서버의 콘텐츠, 즉 데이터베이스에 대한 관리 기능을 위하여 프로젝트를 시작하는 시점에 기본 기능으로 관리자 화면을 제공 우아한 URL 설계 - 파이썬 프레임워크의 일반적인 우아한 URL 방식을 채택 자체 템플릿 시스템 - 내부적으로 확장이 가능하고 디자인이 쉬운 강력한 템플릿 시스템을 가지고 있다. - 화면 디자인과 로직에 대한 코딩을 분리하여 독립적으로 개발 진행이 가능하다...
-
[Django] Django 3에서 namespace의 사용프로그래밍/Django & Flask 2020. 10. 23. 18:43
Django 3에서는 namespace 기능을 지원해주지 않는다고 한다. namespace 대신에 app_name을 사용해야 한다! Project name: Mysite Application name: polls # mysite/urls.py from django.contrib import admin from django.urls import path, re_path, include from polls import views urlpatterns = [ re_path(r'^polls/', include('polls.urls')), re_path(r'^admin/', admin.site.urls), ] # polls/urls.py from django.contrib import admin from djan..
-
🤖 웹 프로그래밍의 이해프로그래밍/Django & Flask 2020. 10. 22. 14:23
웹 프로그래밍의 이해 - 웹 프로그래밍이란? HTTP 프로토콜로 통신하는 클라이언트와 서버를 개발하는 것을 의미한다. 보통은 웹 서버를 개발하는 경우가 많아 파이썬 웹 프로그래밍이라고 하면 장고와 같은 웹 프레임워크를 사용하여 웹 서버를 개발하는 것을 떠올린다. 브라우저를 띄워 네이버에 접속하는 것 = 브라우저(웹 클라이언트), 네이버 서버(웹 서버) - 웹 서버에 요청을 보내는 웹 클라이언트 1) 웹 브라우저를 사용하여 요청 2) 리눅스 curl 명령을 사용하여 요청 3) Telet을 사용하여 요청 4) 직접 만든 클라이언트로 요청 - HTTP 프로토콜 HTTP는 웹 서버와 웹 클라이언트 사이에서 데이터를 주고받기 위해 사용하는 통신 방식으로 TCP/IP 프로토콜 위에서 동작한다. 1. 웹 브라우저에 ..
-
[python] sort와 sorted 차이프로그래밍/Python 2020. 8. 13. 09:29
1) sort - 리스트를 정렬하는 함수이다. - sort는 리스트 본체를 바꾼다. - 스트링은 정렬이 안된다. A.sort() # 오름차순 정렬 A.sort(reverse=True) # 내림차순 정렬 2) sorted - sort와 같이 리스트를 정렬하는 함수이다. - 하지만 본체를 바꾸지 않고 바뀐 값을 보여주기만 한다. (A 리스트 자체를 바꾸려면 하나씩 출력해서 넣어줘야함) - 스트링을 리스트로 변환해서 정렬해준다. sorted(A) #오름차순 정렬 sorted(A, reverse=True) #내림차순 정렬
-
[파이썬] 블로그 제목 크롤러 만들기 make a crawler for crawling blog title프로그래밍/Python 2020. 2. 1. 00:25
사실 긁어오는 것 자체는 어렵지 않다. 크롬 - 검사 기능을 통해 해당 태그만 잘 긁어오면 되니까. 오늘은 티스토리 게시글 제목을 긁어오는 크롤러를 만들어보자 R 통계 과제하며 썼던 코드를 짜집기 해보도록 하자^*^ ※여기부턴 시행착오가 매우 많은 코드니 맨 밑에 정리된 코드를 사용할 것※ import os from selenium import webdriver import time #유튜브 댓글과 같이 스크롤 해야 뜨는 형식을 위해 쓰는 코드니까 지금은 딱히 필요없다 from selenium.webdriver.common.keys import Keys #얘도 유튜브 검색할때 쓰던거라 딱히 필요 없음 import pandas as pd from bs4 import BeautifulSoup os.chdir..
-
[R studio] T-TEST & WELCH TEST.R프로그래밍/R 2019. 10. 13. 21:43
R STUDIO T-TEST 과정 1) 등분산 검증 귀무가설(영가설): 두 변수의 분산은 같다. 대립가설: 두 변수의 분산은 다르다. var.test(변수1, 변수2) -> P값이 0.05보다 작으면 귀무가설 기각, 크면 귀무가설 성립 귀무가설이 성립되면(등분산) -> T-test 기각되면(등분산X) -> Welch test 2-1)T-test t.test(종속변수~독립변수, data= , var.equal=TRUE) T검증 또한 P값이 0.05보다 작으면 귀무가설이 기각되고, 크면 성립 2-2)Welch test t.test(종속변수~독립변수, data= ) T.test와의 차이는 var.equal값이 true냐 false냐이다. var.equal값을 지정해주지 않으면 자동으로 false 처리된다. 양..
-
[R studio] 기술통계 출력하는 다양한 방법들.R프로그래밍/R 2019. 9. 29. 20:16
# 기술통계 기술통계란 평균, 표준편차, 분산 등 연속형 데이터를 의미있는 수치로 나타내는 것을 말한다. R로 기술통계를 추출하는 방법은 여러가지가 있는데 간단한 예제를 이용해 살펴보고자 한다. (물론 본문에 기재된 함수들 말고도 더 있음.) # 직접 만든 간단한 예제 # R에서 엑셀데이터 불러오기 위의 엑셀 데이터를 R로 불러오려면 readxl 패키지를 이용하면 된다. 다만 주의할 점은 해당 파일이 있는 디렉토리 경로를 디폴트로 설정해야 한다는 것! install.packages("readxl") library(readxl) list = read_excel("예제.xlsx") #기술통계량 출력하기 - list 테이블에 있는 '나이' 변수를 통해서 기술통계량을 구해보도록 하자. 1) summary 함수 ..