Skip to content

Instantly share code, notes, and snippets.

@kuredev
Created November 17, 2017 15:42
Show Gist options
  • Select an option

  • Save kuredev/8f8f605495d5ef794de3f78846556896 to your computer and use it in GitHub Desktop.

Select an option

Save kuredev/8f8f605495d5ef794de3f78846556896 to your computer and use it in GitHub Desktop.
Numpyの小さなメモ
import numpy as np
x = np.array([-1.0, 1.0, 2.0])
print(type(x))
print(x)
y = x > 0
print(type(y))
print(y)
z = y.astype(np.int)
print(type(z))
print(z)
@kuredev

kuredev commented Nov 17, 2017

Copy link
Copy Markdown
Author
# python n.py
<class 'numpy.ndarray'>
[-1.  1.  2.]
<class 'numpy.ndarray'>
[False  True  True]
<class 'numpy.ndarray'>
[0 1 1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment