Informatics Practices: Data Handling Experiment
Informatics Practices: Data Handling Experiment
Problem Definition
Write a Python program to create a Numpy array. Name the array odd to store the
first ten odd numbers. Create a Pandas Series sod from the Numpy array and
perform the following functions.
Program Code
import numpy as np
import pandas as pd
odd=np.arange(1,20,2)
sodd=pd.Series(odd)
print(sodd)
print(sodd.head())
print(sodd.tail(3))
print(sodd[::-1])
print(sodd[sodd>10])
print(sodd*2)
sodd[2]=0
print(sodd)
Input/Output
0 1
1 3
2 5
3 7
4 9
5 11
6 13
7 15
8 17
9 19
dtype: int32
0 1
1 3
2 5
3 7
4 9
dtype: int32
7 15
8 17
9 19
dtype: int32
9 19
8 17
7 15
6 13
5 11
4 9
3 7
2 5
1 3
0 1
5 11
6 13
7 15
8 17
9 19
dtype: int32
0 2
1 6
2 10
3 14
4 18
5 22
6 26
7 30
8 34
9 38
dtype: int32