# HG changeset patch # User Jeff Hammel # Date 1504465863 25200 # Node ID 926c127305fa463291070fc2537f09d0820e9b33 # Parent ec5f97abf8edd4e29a2af4d4aae7f79276e78f6e [np] this is how broadcasting works diff -r ec5f97abf8ed -r 926c127305fa tests/test_broadcasting.py --- a/tests/test_broadcasting.py Sun Sep 03 12:07:49 2017 -0700 +++ b/tests/test_broadcasting.py Sun Sep 03 12:11:03 2017 -0700 @@ -15,7 +15,13 @@ class TestBroadcasting(unittest.TestCase): def test_basic(self): - """example of braodcasting""" + """example of broadcasting""" + + A = np.array(calories) + cal = A.sum(axis=0) + print (cal) + percentage = 100*A/cal.reshape(1,4) + print (percentage) if __name__ == '__main__': unittest.main()