Notice
Recent Posts
Recent Comments
07-21 01:07
Archives
관리 메뉴

develop myself

numpy basic tips 본문

DataScience/Python

numpy basic tips

insightous 2023. 1. 26. 16:38

ndarray

numpy의 기본 데이터 타입.

class 이다.

 

ndarray 생성 함수

import numpy as np
# ndarray 생성 
a = np.array([1,2,3,4])

# ndarray 생성의 여러 예
b = np.zeros((3,3)) 
c = np.ones((3,4)) 
d = np.full((2,2),7) # 명시된 값으로 채우기
e = np.eye(3,3) 
f = np.random.random((2,2)) 
g = np.arange(5)

수학 함수

a = np.array([np.e, 2, 3])
np.abs(a) 
np.sqrt(a) 
np.log(a) 
np.floor(a) 
np.ceil(a) 
np.rint(a) #  a에 가장 가까운 정수 를 나타내는 float 타입의 값을 반환

비교 모듈: math

import math

math.e
np.e

'DataScience > Python' 카테고리의 다른 글

matplotlib basic tips  (0) 2023.01.26
pandas basic tips  (0) 2023.01.26
Python help, dir  (0) 2023.01.26
jupyter notebook magic commands, shell commands  (0) 2023.01.26
Python formatting: format() method, f-string  (0) 2023.01.25
Comments