#### World's Best AI Learning Platform with profoundly Demanding Certification Programs

Designed by IITian's, only for AI Learners.

Designed by IITian's, only for AI Learners.

New to InsideAIML? Create an account

Employer? Create an account

Download our e-book of Introduction To Python

How to leave/exit/deactivate a Python virtualenvironment Exception Type: JSONDecodeError at /update/ Exception Value: Expecting value: line 1 column 1 (char 0) How to split numpy array with mask? How can i change terminal path in vscode? Create a dataframe with number of column and and column names according to the user How to Delete Python Object? Automatically run %matplotlib inline in IPython Notebook Explain Scopes in Python? Join Discussion

4.5 (1,292 Ratings)

547 Learners

Oct 13th (7:00 PM) 431 Registered

Neha Kumawat

10 months ago

- Introduction

- Operations on data using Numpy

1. How to create ndarray?

- Data Operations in Pandas

1. Series in Pandas

2. DataFrame in Pandas

In this article, we will try to see how we can
perform some operations on our data frame using python libraries like Pandas and
Numpy. We all know how important and useful these python libraries are while we
are performing an Exploratory Data Analysis or any Data Science projects.

Here we will try to learn some basic examples
from each of the two libraries and see how they help us to operate on the
data.

Numpy package is a very important library
provided by python used for any mathematical operation is to be done. This
Package is very important for performing any Machine learning and Deep Learning
tasks.

Numpy stands for N-dimensional array called
ndarray. It describes the collection of items of
the same type. Items in any collections can be accessed using a zero-based
index. An instance of ndarray class can be constructed by different array
creation.

Let’s
see with some examples, how basic ndarray is created using an array function in
Numpy.

```
import numpy as np
arr = np.array([[4, 6], [7, 8]])
print(arr)
```

```
[[4 6]
[7 8]]
```

```
import numpy as np
arr = np.array([1, 2, 3, 4, 5], ndmin = 2)
print(arr)
```

`[[1 2 3 4 5]]`

```
import numpy as np
arr = np.array([1, 2, 3], dtype = complex)
print(arr)
```

`[1.+0.j 2.+0.j 3.+0.j]`

Python pandas library provides many functions
to handles data through Series, Data Frame,
and Panel.

Pandas Series is a one-dimensional labeled array
which is capable of holding data of any type (integer, string, float, python
objects, etc.). The axis labels are collectively known as index.

Now let’s take an
example and understand it in a better way

```
import pandas as pd
import numpy as np
data = np.array(['P','Q','R','S'])
series = pd.Series(data)
print(series)
```

```
0 P
1 Q
2 R
3 S
dtype: object
```

Pandas data frame is a two-dimensional data
structure in python. Here, data is aligned in a tabular form in rows and
columns.

Let’s see how we can create pandas DatFrame.

Let’s see an example

```
import
pandas as pd
data =
{'Name':['Ram', 'Mohan', 'Amit', 'Ricky'],'Age':[23,25,29,36]}
df1 =
pd.DataFrame(data, index=['rank1','rank2','rank3','rank4'])
print(df1)
```

```
Name Age
rank1 Ram 23
rank2 Mohan 25
rank3 Amit 29
rank4 Ricky 36
```

For more blogs/courses on data science, machine learning, artificial intelligence, and new technologies do visit us at** InsideAIML**.

Thanks for reading…