#### Overview of this book

Learning SciPy for Numerical and Scientific Computing Second Edition
Credits
www.PacktPub.com
Preface
Free Chapter
Introduction to SciPy
Working with the NumPy Array As a First Step to SciPy
SciPy for Linear Algebra
SciPy for Numerical Analysis
SciPy for Signal Processing
SciPy for Data Mining
SciPy for Computational Geometry
Interaction with Other Languages
Index

## Using datatypes

There are several approaches to impose the datatype. For instance, if we want all entries of an already created array to be 32-bit floating point values, we may cast it as follows:

```>>> import scipy.misc
>>> img=scipy.misc.lena().astype('float32')
```

We can also use an optional argument, `dtype` through the command:

```>>> import numpy
>>> scores = numpy.array([101,103,84], dtype='float32')
>>> scores
```

The output is shown as follows:

```array([ 101.,  103.,   84.], dtype=float32)
```

This can be simplified even further with a third clever method (although this practice offers code that are not so easy to interpret):

```>>> scores = numpy.float32([101,103,84])
>>> scores
```

The output is shown as follows:

```array([ 101.,  103.,   84.], dtype=float32)
```

The choice of datatypes for NumPy arrays is very flexible; we may choose the basic Python types (including `bool`, `dict`, `list`, `set`, `tuple`, `str`, and `unicode`), although for numerical computations we...