Skip to content

Instantly share code, notes, and snippets.

@njsmith
Last active August 29, 2015 14:07
Show Gist options
  • Save njsmith/551738469b74d175e039 to your computer and use it in GitHub Desktop.
Save njsmith/551738469b74d175e039 to your computer and use it in GitHub Desktop.
>>> np.__version__
'1.8.1'
>>> ar = np.ma.array([1, 1, 1, np.ma.masked, 1, 1, 1])
>>> ar
masked_array(data = [1.0 1.0 1.0 -- 1.0 1.0 1.0],
mask = [False False False True False False False],
fill_value = 1e+20)
>>> np.gradient(ar)
masked_array(data = [0.0 0.0 -- 0.0 -- 0.0 0.0],
mask = [False False True False True False False],
fill_value = 1e+20)
>>> ar
masked_array(data = [1.0 1.0 -- nan -- 1.0 1.0],
mask = [False False True False True False False],
fill_value = 1e+20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment