

An alternate example is the pi function: you can use math.pi, numpy.pi or scipy.pi and they all give the same value for pi. Sometimes, it is better to use import module, especially if we are using two modules that have a function of the same name - using this method will allow us to distinguish between the two. For example, numpy.sin can evaluate values of sine of an array but math.sin can only be used to evaluate the sine of a single value. We use modules in different ways depending on our needs. For example, sin(math.pi/2) will evaluate sine of pi/2. After we run this statement, we can use sine and cosine without specifying the module, but not other functions in this module. from math import sin, cos imports the module math.For example, sin(pi/2) will evaluate sine of pi/2. After we run this statement, we can simply use functions defined in module math without specifying the module they came from. from math import * imports the module math.For example, math.sin can be used to evaluate the value of trigonometric function sine and math.sin(math.pi/2) = 1. After we run this statement, we can use math.name to refer to functions defined in module math. Python provides several ways to import modules we introduce three ways below. 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc']Ī package is a directory that consists of multiple modules and sub-packages.ĭir() and help() can be used to explore packages as well. The dir() function can be used to see which functions are implemented in a module and help() can be used to see more detail about the function we want to use. We can use modules to group related codes.
HOW TO INSTALL MATPLOTLIB CMD UPGRADE
HOW TO INSTALL MATPLOTLIB CMD HOW TO
How to install libraries / packages / modules?įirst open Spyder and click Tools -> Open command prompt. To search a package: pip search "package" To upgrade a package: pip install -upgrade package OR pip install -U package To uninstall a package: pip uninstall package To install a package: pip install package

It is included in the installation of Anaconda. Pip is a package management system used to install and manage Python packages.
