DABANG

import pandas as pd
import matplotlib.pyplot as plt

data = {‘ename’: [“Rinkoo Sharma”, “Shiv Bansal”, “Raman Ahuja”, “Aman Sharma”],
‘desig’: [“Mngr”, “Clrk”, “Clrk”, “Salesman”],
‘Salary’: [80000, 45000, 35000, 55000]}

s = pd.DataFrame(data)
print(“………. Q1. 1 …………..”)
print(s)

print(“………. Q1. 2 …………..”)
print(s.loc[:, [‘desig’, ‘Salary’]])

s.loc[4] = [‘Papu’, ‘Lalu’, 100]

print(“………. Q1. 3 …………..”)
print(s)

print(“………. Q1. 4 …………..”)
s.iloc[1:2, 2:3] = [100000]
print(s)

s[‘bonus’] = s[‘Salary’] * 15 / 100

print(“………. Q1. 5 …………..”)
print(s)

print(“………. Q1. 6 …………..”)
plt.bar(s[‘ename’], s[‘Salary’], label=’salaryE’)
plt.xlabel(‘Name’)
plt.ylabel(‘Sal’)
plt.title(‘Employee Salaries’)
plt.legend()
plt.grid()

plt.show()

Call Now Button