Foundational Python for Data Science by Kennedy Behrman

Foundational Python for Data Science by Kennedy Behrman

Author:Kennedy Behrman [Kennedy Behrman]
Language: eng
Format: epub
Publisher: Addison-Wesley Professional
Published: 2021-09-22T00:00:00+00:00


Figure 8.1 Demo Image from the scipy.misc Submodule

As you can see in this example, you use the plt.imshow() method to visualize images.

The scipy.special Submodule

The scipy.special submodule contains utilities for mathematical physics. It includes Airy functions, elliptical functions, Bessel functions, Struve functions, and many more. The majority of these functions support broadcasting and are compatible with NumPy arrays. To use the functions, you simply import scipy.special from SciPy and call the functions directly. For example, you can calculate the factorial of a number by using the special.factorial() function:

Click here to view code image

from scipy import special special.factorial(3) 6.0

You can calculate the number of combinations or permutations as follows:

Click here to view code image

special.comb(10, 2) 45.0 special.perm(10,2) 90.0

This example shows 10 items and choosing 2 of them at a time.

Note

scipy.special has a scipy.stats submodule, but it is not meant for direct use. Rather, you use the scipy.stats submodule for your statistics needs. This submodule is discussed next.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.