Pandas Session 1 Code

 Pandas Session 1 Code For Video Click Fahad Hussain CS


Hi, Welcome to Fahad Hussain CS blog, do not forget to subscribe and follow the blog and YouTube channel  Fahad Hussain CS

Code:

!pip install pandas


import pandas as pd

import numpy as np


obj = pd.Series([3,2,4,-5])

print(obj)


print(type(obj))

print(obj.values)

print(obj.index)


obj2 = pd.Series([1,2,3,4],index=['a','b','c','d'])

print(obj2)

print(obj2.index)


obj2['b'] = 6

obj2['a','c','d'] = 100

print(obj2)


print(np.exp(obj2))


print('b' in obj2)

print('e' in obj2)


sdata = {'HR': 3500, 'Marketing': 7100,'Indoor': 1600, 'Outdoor': 500}

obj3 = pd.Series(sdata)

print(obj3)


States = ['South','East','North','West']

obj4 = pd.Series(obj3, index=States)

print(obj4)


print(pd.isnull(obj4))

print(pd.notnull(obj4))


print(obj3 + obj4)


No comments:

Post a Comment

Fell free to write your query in comment. Your Comments will be fully encouraged.