NumPy: The tricks of the trade (Part II)
This post will describe about the more advanced and fun stuff about NumPy. For basics, refer to Part I. Vectorization First let鈥檚 revisit how we would do any arithmetic operation on all the elements of list (Python in-built container). Looping through all the elements is probably the only way to go about it. The neatest syntax is using list comprehensions. # List Comprehension >>> L = [1,2,3,4] >>> [i * 2 for i in L] # list comprehension [2, 4, 6, 8] Now imagine doing this for a multi-dimensional list of data and think about the readability....
NumPy: The Tricks of Trade (Part I)
This post aims to highlights some of the basic features of NumPy which gives it an edge over Python in-built containers for computational purposes. The next post will talk about some advanced and more fascinating features of NumPy. NumPy is an extension package for performing efficient manipulations in multi-dimensional data. The numpy array object is extremely efficient at handling such arithmetics and provides vast support for basic and advanced manipulations....