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

Designed by IITian's, only for AI Learners.

Download our e-book of Introduction To Python

Why ReLU is used only on hidden layers specifically? What are local and global scope? Open a text file and find the longest word in the text file and find the length. How to plot Bubble plot with Encircling? What is use of Heat map ? How to plot heat map? Backpropagation: In second-order methods, would ReLU derivative be 0? and what its effect on training? What is TF/IDF vectorization? Which sorting technique is used by sort() and sorted() functions of python? Join Discussion

4 (4,001 Ratings)

220 Learners

Neha Kumawat

a year ago

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.

Data Operations

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…

We're Online!

Chat now for any query