일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 2025년도 미국 관세
- css 리스크
- Python Numpy
- 25년 3월 미국 증시 분석
- 2025년 3월 6일 미국 증시 분석
- Cudnn 버전 확인
- 연체 css
- 트럼프 미국 관세
- 25년 3월 11일 미국 증시 분석
- 미국 투자 분석
- 미국 시황
- 트럼프 2025년 미국 관세
- 미장 분석
- 코딩 사이트 정리
- 25년 3월 증시 분석
- 딥러닝 제대로 시작하기
- 미국 증시 분석
- jupyter notebook PDF
- 취업사이트 정리
- 미국 증시 방향성
- 주식 데이터 수집
- 스코어카드 예시
- 연체용어
- css 리스크관리
- 스코어카드 만드는법
- 딥러닝
- 25년 3월 12일 미국 증시 분석
- python pandas
- 관세 설명
- css risk
Archives
- Today
- Total
koos808
Python Numpy Function Part2 - 파이썬 넘파이 함수 본문
728x90
반응형
-
Numpy 배열 길이 확인 방법
data.shape
orlen(data)
-
Numpy의 around() 함수
- 반올림 함수
np.round(data, 2)
ornp.around(data, 2)
사용
- 반올림 함수
-
Numpy 배열에서 원소(value) 몇 개씩 존재하는지 count(R에서의 table)
# example 1 from collections import Counter Counter(jaffe_Y) # example 2 result = Counter(jaffe_Y) print(result) for key in result: print(key, result[key]) # example 3 import numpy as np x = np.array([1,1,1,2,2,2,5,25,1,1]) y = np.bincount(x) ii = np.nonzero(y)[0] Zip(ii,y[ii]) # [(1, 5), (2, 3), (5, 1), (25, 1)] # example 4 : 키 없이 카운트 한 값만 알아내고 싶을 때 사용 result = Counter(jaffe_Y).values() print(result)
-
Numpy 배열에서 어떤 값이 중복됐는지 확인하는 방법
# 1. 중복된 값만 추출 from collections import Counter a = np.array([1, 2, 1, 3, 3, 3, 0]) [item for item, count in Counter(a).items() if count > 1] # 2. 중복된 값의 인덱스 추출 u, c = np.unique(a, return_counts=True) dup = u[c > 1] # 3. 유니크한 값만 가져오기 np.unique(data)
- 2D, 3D... array에서 중복된 값 제거하고 가져오는 방법
L = [np.array([1, 2, 3]), np.array([]), np.array([3, 2, 1]), np.array([1, 3, 2]), np.array([1, 2, 3]), np.array([1, 3, 2]), np.array([]), np.array([]), np.array([1, 2, 3]),np.array([7,7,7])] L `np.unique(L, axis=0)`
- 응용 : A 변수에서 중복된 데이터 제외한 인덱스를 가져와 B 변수 select
u, indices = np.unique(fer2013_X, axis=0, return_index = True)
->fer2013_label = fer2013_label[indices]
- 2D, 3D... array에서 중복된 값 제거하고 가져오는 방법
728x90
반응형
'Python' 카테고리의 다른 글
data shuffle 섞는 방법 sklearn (0) | 2020.11.14 |
---|---|
python에서 문자 출력할 때 raw로 출력하기 (0) | 2020.11.14 |
Python Numpy Function Part1 - 파이썬 넘파이 함수 (0) | 2020.11.10 |
이미지 resize 후 저장하는 파이썬 코드 python image resize save (0) | 2020.11.08 |
[파이썬] 폴더 내 파일명 일괄 변경하는 방법. Python Code (0) | 2020.11.02 |