You are on page 1of 42

PROGRAM FOR EMPTY SERIES

import pandas as pd import pandas as pd


S=pd.Series([],dtype='float') S=pd.Series((),dtype=‘int')
print(S) print(S)

OUTPUT OUTPUT

import pandas as pd import pandas as pd


S=pd.Series({},dtype='float64') S=pd.Series([],dtype=‘object')
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
List=[10,20,30,40] Tap=(10,20,30,40)
S=pd.Series(List) S=pd.Series(Tap)
print(S) print(S)

OUTPUT OUTPUT
import pandas as pd import pandas as pd
List=[10,20,30,40] List=[10,20,30,40]
S=pd.Series(List, S=pd.Series(data=List,
index=['a','b','c','d']) index=['a','b','c','d'])
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
List=[10,20,30,40] List=[10,20,30,40]
S=pd.Series(30) S=pd.Series(data=[40,50])
print(S) print(S)

OUTPUT OUTPUT
import pandas as pd import pandas as pd
List=[10,20,30,40] List=[10,20,30,40]
S=pd.Series(67, S=pd.Series(data=90,
index=['a','b','c','d']) index=['a','b','c','d'])
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
List=[10,20,30,40] List=[10,20,30,40]
S=pd.Series(2*3-2, S=pd.Series(14/5,
index=['a','b','c','d']) index=['a','b','c','d'])
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
List=[10,20,30,40] List=[10,20,30,40]
S=pd.Series(14/5, S=pd.Series(14/5,
index=['a','b','c','d'], index=['a','b','c','d'])
dtype='int') print(S)
print(S)
OUTPUT
OUTPUT
import pandas as pd import pandas as pd
L1=[10,20,30,40] L1=[10,20,1,40]
L2=[4,3,2,1] L2=[4,3,10,1]
S=pd.Series(L1+L2) S=pd.Series(L1-L2)
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
L1=[10,20,30,40] import numpy as np
L2=[4,3,2,1] L1=np.array([10,20,30])
S=pd.Series(L1+L2) L2=[10,20,1]
print(S) S=pd.Series(L1+L2)
print(S)
OUTPUT
OUTPUT
import pandas as pd import pandas as pd
import numpy as np import numpy as np
data=np.array([10,20,30]) L1=np.array([10,20,30])
L1=[10,20,1] L2=[10,20,1]
S=pd.Series(L1-data) S=pd.Series(L1+L2)
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
L1=[10,20,30,40] L1=[10,20,1]
L2=[4,3,2,1] S=pd.Series(L1+20)
S=pd.Series(L1+L2) print(S)
print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
L1=[10,20,1] L1=[10,20,1]
S=pd.Series(L1*3) L2=[4,5,6]
print(S) S=pd.Series(L1*L2)
print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
S=pd.Series(range(10,20)) S=pd.Series(range(5))
print(S) print(S)

OUTPUT OUTPUT
import pandas as pd import pandas as pd
S=pd.Series(range(10,20)) S=pd.Series(range(5),
print(S) index=['a','b','c','d','e'])
print(S)
OUTPUT
OUTPUT
import pandas as pd import pandas as pd
S=pd.Series(3*3, S=pd.Series(3*3,index=range(100,106))
index=['a','b','c','d','e']) print(S)
print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
S=pd.Series(data='pop’, S=pd.Series('pop',index=range(100,106))
index=range(100,106)) print(S)
print(S)

OUTPUT OUTPUT
import pandas as pd import pandas as pd
S=pd.Series('pop', S=pd.Series(34,
range(100,106)) range(100,106),
print(S) dtype='float')
print(S)
OUTPUT
OUTPUT
import pandas as pd import pandas as pd
d1={'A':90,'B':100} L1=[1,2,3]
S=pd.Series(d1) L2=[10,3]
print(S) S=pd.Series(L1+L2)
print(S)
OUTPUT
OUTPUT
import pandas as pd import pandas as pd
import numpy as np import numpy as np
d1=np.array([10,np.NaN,30]) d1=np.array([10,np.NaN,30])
d2=np.array([10,30,40]) d2=np.array([10,30,40])
S=pd.Series(d1+d2) S=pd.Series(d1-d2)
print(S) print(S)
OUTPUT OUTPUT
import pandas as pd import pandas as pd
S=pd.Series([10,20,40,50], S=pd.Series([10,20,40,50],
index=['A','A','B','C']) index=['A','A','B','C'])
print(S) print(S['A'])
OUTPUT
OUTPUT

import pandas as pd
S=pd.Series([10,20,40,50],
index=['A','A','B','C'])
S['A']=100
print(S['A'])
OUTPUT
import pandas as pd import pandas as pd
S=pd.Series([10,20,40,50], S=pd.Series([10,20,40,50],
index=['A','A','B','C']) index=['A','A','B','C'])
print(S) S['A']=100
print(S['A'])
OUTPUT print(S)
OUTPUT
import pandas as pd import pandas as pd
S=pd.Series([10,20,30], S=pd.Series([10,2.45,30],
index=['A','B','C']) index=['A','B','C'])
print(S) print(S)

OUTPUT OUTPUT

import pandas as pd OUTPUT


S=pd.Series(['POP',2.45,30],
index=['A','B','C'])
print(S)
import pandas as pd import pandas as pd
S=pd.Series([10,20,40,50], S=pd.Series([10,20,40,50],
index=['A','A','B','C']) index=['A','A','B','C'])
print(S) S['A']=100
print(S['A'])
OUTPUT print(S)
OUTPUT

You might also like