Basic NumPy Packages on Python
Python is a programming language created in 1991 by Guido van Russom. Python claims to be the fastest growing programming language. Python’s popularity is now on the data science track. The large number of libraries and frameworks such as scikit-learn and tensorflow makes data mining, AI, and machine learning lovers love python in their research and research development. The development of the world of data science in this world is also one of the reasons why python is becoming so popular today. Even though it is classified as a high level programming language, python is very easy to understand because of its simple syntax. (www.dqlab.id, 2020)
NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. (www.numpy.org, 2020)
In data analysis we need mathematical calculations that can be done quickly. For example, when we want to calculate the speed of several cars with their respective distances and times, the data we get is as follows:
With formulas so we can calculate Velocity in python by using Space/Times. But this is can’t work without a packages that can calculate ‘list’. So we need that’s packages called Numpy. You can easily install Numpy packages by using pip3 install Numpy or if you use Anaconda, the Numpy packages are already available in it. To simplify the operation of Numpy packages, use Import Numpy as np.
After that we can do the calculate of Velocity:
This is the difference between using lists for python without numpy and with numpy arrays :
With numpy array, you can also do subsetting like this:
Beside that, you can find the array with Boolean type, example :
If we are looking for the type of data, the display will appear as below:
(numpy.)This means that the type is defined in the numpy package
(ndarray) means n dimentional in this case, Space_np has 1 dimention. So its possible to create more than 1 dimentional until n dimentional.
And we also can do subsetting but with a little different. (don’t forget that in python, index is start with zero (0) )
For basic analysis we can also use function below to make your analysis easier. This is very useful when analyzing big data. First of all, we need to know how to import data (such as csv type on python). We need to import pandas packages and read the data that have been save.
this is a small part of many things that I get after take a course on datacamp called introducing with python. And also a little thing that I can share, hopefully its useful-