Python Data Analysis
-
[통계 이론] 1. 평균과 분산, p-value, 귀무가설, 대립가설, 1종 오류Python Data Analysis 2022. 11. 6. 22:54
데이터의 대표적인 특징을 잘 설명해주기 위해서 대표값을 구한다. 그 중에서 평균과 분산을 가장 많이 쓴다. 평균 : 데이터의 중심값으로서 자료의 특성을 대표한다. 단, 아웃라이어의 영향을 많이 받는다(취약하다) 분산 : 평균값을 중심으로 각 데이터가 얼마나 펴져 있는지 (펴져 있는 평균적인 거리를 의미) 각 데이터에서 평균을 빼고, 이 값을 제곱해서 다 더한 뒤 전체 갯수로 나눈다. 자유도는 분자에서 이미 평균값을 한번씩 빼줬기 때문에 전체 갯수-1로 분모도 빼주는 것이라 이해하자 p-value : 유의수준, probability value, 확률값 어떤 사건이 우연히 발생할(독립변수가 종속변수에 영향을 준다고 할 수 없는) 확률 따라서 0.05보다, 5%보다 p값이 높으면 이 사건은 우연히 발생한 것이..
-
[Python] Numpy(넘파이) 내용 정리Python Data Analysis 2022. 11. 6. 12:32
넘파이(Numpy) 수많은 여러 가지 숫자들을 모두 하나의 변수에 넣고 처리하기 위한, 수치 해석용 파이썬 패키지이다. 일반 파이썬의 리스트보다 더 빠르고 메모리를 적게 먹는 배열을 사용한다. 이때 배열 사용을 위해 넘파이를 쓴다. 넘파이 배열의 조건은 다음과 같다. 1. 모든 원소가 같은 자료형이어야 한다. 2. 원소의 갯수를 바꿀 수 없다. 넘파이는 다차원의 배열자료 구조인 ndarray 클래스를 지원하며, 벡터(배열)와 행렬(매트릭스)을 사용하는 선형대수 계산에서 주로 사용한다. 고성능 다차원 배열 객체를 처리하기 위한 여러 도구와 함수를 제공한다. ndarray는 같은 타입을 가진 값들의 grid이며, 양의 정수 튜플로 인덱싱 되어 있다. * 선형대수학 : 행렬을 이용하여 선형적인 문제를 해결하는..
-
[Python 기초 문법] map( ), input( ).split( ), bool( )Python Data Analysis 2022. 10. 4. 20:29
map은 '리스트의 요소'를 '지정된 함수'로 처리해주는 함수이다. 원본 리스트는 그대로 둔 채, 새 리스트를 생성한다. map(지정할 함수, 리스트의 요소) 로 매개변수를 전달해주면 된다. map에는 리스트 뿐만 아니라 모든 반복 가능한 객체를 전달할 수 있다. a=[1.2, 2.3, 3.5, 4.6] a=list(map(int, a)) print(a) [1, 2, 3, 4] map 안에 int 함수와 a라는 리스트를 전달해줬기 때문에, 리스트의 모든 요소에 int 함수가 작동하였고, 그 결과값들을 list 함수로 다시 리스트로 만들어줬다. input( ).split( )은 입력받은 여러 개의 값을 리스트로 구성해준다. 공백으로 각 리스트의 요소를 구분한다. b=input().split() print(..
-
python 기초 문법 (+ 산술, 관계, 논리 연산자 / 2진수, 8진수, 16진수)Python Data Analysis 2022. 10. 3. 19:03
is 는 참조값의 주소를 비교하는 것이고, == 은 객체가 갖고 있는 값을 비교하는 것이다. 들어 있는 값은 '1000'으로 같기 때문에 ==을 했을 때 true이고, 두 객체의 참조값 주소는 다르기 때문에 'is'를 했을 때 False가 나온다. * 기본 숫자들은 모두 10진수 형태로 표현된 것이다. 따라서 다른 진수의 형태로 숫자를 표현하려면, 다음과 같은 접두사를 붙여줘야 한다. - 2진수 : 0b - 8진수 : 0o - 16진수 : 0x 내장되어 있는 함수, bin(), oct(), hex()를 이용해서 2진수, 8진수, 16진수 형태의 문자열로 변환할 수도 있다. 다른 진수의 문자열을 다시 숫자로 변환하려면, int('문자열', 문자열의 진수값)을 이용하면 된다. 모든 문자열은 print() 만..