Importing Numpy in Pycharm
Numpy :
Numpy is one of the important library in python. The abbreviation of numpy is “Numerical python” or “Numeric Python”.
This library is mainly used to access arrays. Numpy was created in the year 2005 by Travis Oliphant. It is an open source library and every one can access it easily.
It is mainly used to perform mathematical and logical operations on the arrays and matrices. It is mainly useful fundamental scientific computations in machine learning.
Numpy consists of compact data storage. It also consists high speed processing of the arrays. It can also store numbers as the primitive data types.
Numpy is as same as arrays so it has fixed size and it can also access the multi dimensional arrays. The class in numpy array is known as ndarray or also known as alias array.
Features of numpy :
- It consists of high performance multi-dimensional array object.
- It consists of tools for integrating C and C++ and FORTRAN code.
- Numpy consists of sophisticated and broadcasted functions.
- Numpy can perform operations on linear algebra, random number capabilities and fourier transformation.
Installation of Numpy in python :
We can install numpy in Mac and Linux using pip command. It provides high level of functioning tools to work with arrays. The prerequisite to install numpy is python itself. If we do not have python then we can also use the anaconda distribution which consists of jupyter notebook.
It consists of python and another packages of python such as numpy, pandas, scipy, matplotlib etc.
Step – 1: Inorder to install python the fist step we need to do is to check the python version. Because it is important to check the version of python. Few versions cannot access the libraries so we need to check the version and if there is any update in the version we need to upgrade the python version.
Step – 2: After checking the version of python we need to install pip. pip is also known as package installer for python. It connects to all online packages called as Python Package Index. We can install numpy easily using pip.
Step – 3: Then we need to install the numpy using the following command :
pip install numpy
By using the above command we can install numpy.
Step – 4: After installing numpy we have to check whether the numpy package is installed or not. We can check it using the following command:
import numpy
(or)
python -m pip show numpy
By using the above command we can specify whether the numpy is installed or not, if numpy is installed then it can be imported and accessed else it prints the output as “No module named ‘numpy’”.
Step – 5: After completing of installation of numpy package and after completion of verification of numpy package we need to import the numpy package so that we can access the package.
In this way we can install numpy in python. Not only in the above way we can also follow few other ways to install numpy such as using command prompt and also using python idle shell.
The way installing numpy in python is completely different from the way installing numpy in pycharm.
Let us see an example for importing and accessing numpy in python :
import numpy as np
arr = np.array( [ 1 , 5 , 9 , 2 , 7 ] )
print(“The array list is : “ arr )
Output :
The array list is : [ 1 , 5 , 9 , 2 , 7 ]
Pycharm :
Pycharm is one of the Integrated Development Environment ( IDE ) in python. Pycharm is a hybrid platform used for python that is developed by JetBrains as Integrated Development Environmment ( IDE ) for python.
It is used for application development. It provides more number of essential tools for python developers. It is used to create more effective environment in python, python web and data science development.
For simple python programs python IDLE is more preferable than compared to pycharm, but pycharm is more effective and it can be mainly used in large projects. In other words we can say that pycharm is one of the best Integrated Development Environment ( IDE ) used for python.
Using pycharm we can access the command prompt and then we can connect to the data base and so we can create virtual environment and can control the version of packages and python. It will save the time so that all the control systems can be accessed it one place.
Installing numpy in pycharm :
We can install numpy in pycharm in many way. Let us see one of the way as shown below :
Step – 1: Inorder to install numpy in pycharm we need to go to file and then we should click on settings.
Step – 2: After clicking on the settings we will see “Project:your_project_name”. Now we should click on it, then we can see two options on the screen, one is Project Interpreter and the other is Project Structure.
Step – 3: Now in the two above options we should go to Project Interpreter. There we can see all the packages that are installed. Where we can see all the packages that should be installed in the pycharm such as numpy, pandas, scipy, matplotlib etc.
Step – 4: In Project Interpreter there we can able to see “ + ” button. Click on that button , where we can find the packages. After clicking “ + “ button search for the required package that is need to be installed. Here we are installing numpy package so search for numpy in search field. There we can see numpy package in left side and on right we can see the version of the package. Before selecting the installation of package we need to check the URL and author of the package.
Step – 5: Then we should click on install the packages on the left bottom of the site. If there occurs an error then we can also use pip command as “ pip install numpy “ .
Step – 6: After installing numpy we have to check whether the numpy package is installed or not. We can check it using the following command:
import numpy
(or)
python -m pip show numpy
By using the above command we can specify whether the numpy is installed or not, if numpy is installed then it can be imported and accessed else it prints the output as “No module named ‘numpy’”.
We can install the numpy in pycharm using the above shown steps.