NumPy diff()

Jmnote bot (토론 | 기여)님의 2021년 5월 13일 (목) 21:45 판 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))

1 개요

NumPy.diff()
import numpy as np
x = np.array([1, 2, 4, 7, 0])
print( np.diff(x) )      # [ 1  2  3 -7]
print( np.diff(x, n=2) ) # [  1   1 -10]
import numpy as np
x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]])
print( np.diff(x) ) # [[2 3 4]
                    #  [5 1 2]]
print( np.diff(x, axis=0) ) # [[-1  2  0 -2]]
import numpy as np
x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64)
print( np.diff(x) )

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}