Skip to content

Instantly share code, notes, and snippets.

@akhalsa
Created January 16, 2017 22:08
Show Gist options
  • Save akhalsa/f69f6a111be81d55cff341eec0204af4 to your computer and use it in GitHub Desktop.
Save akhalsa/f69f6a111be81d55cff341eec0204af4 to your computer and use it in GitHub Desktop.
import numpy as np
def expSum(items):
temp = np.copy(items)
for x in np.nditer(temp, op_flags=['readwrite']):
x[...] = np.exp( x)
print "Using nditer and loop"
print temp
print "transpose"
for column in items.T:
print "column"
print column
x = np.arange(1, 6, 2)
scores = np.vstack([x, np.ones_like(x), 0.2 * np.ones_like(x)])
print scores
expSum(scores)
x = np.array((9,5,8,6,4,11)).reshape(3,2)
print x
print x.min(axis=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment