### Numpy...why so serious?

What can we really do with Numpy? Why should we use it at all ?

Start with : import numpy

1. We can create arrays .

method: numpy.array(object, dtype=None, copy=True, order='K', subok=False, ndmin=0)

>>> a = numpy.array(range(10)) >>> a array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> a.dtype dtype('int32')

In the above array, there are 10 columns and 1 row.

Note : The concept of

Refer this link.

2. We can create/convert array of a particular type (immediate conversion of your list to a desired type)

>>> s = numpy.array(range(10), dtype=str) >>> s array(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], dtype='|S1')-------------------------------…

Start with : import numpy

1. We can create arrays .

method: numpy.array(object, dtype=None, copy=True, order='K', subok=False, ndmin=0)

>>> a = numpy.array(range(10)) >>> a array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> a.dtype dtype('int32')

In the above array, there are 10 columns and 1 row.

Note : The concept of

*rows*and*columns*applies when you have a 2D array. However, the array numpy.array([1,2,3,4]) is a 1D array and so has only one dimension, therefore shape rightly returns a single valued iterable.Refer this link.

2. We can create/convert array of a particular type (immediate conversion of your list to a desired type)

>>> s = numpy.array(range(10), dtype=str) >>> s array(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], dtype='|S1')-------------------------------…