Advanced IP Scanner questions & answers

Displays all the devices connected to a network
Question by Guest
July 16, 2021

(i)Write a Python code to create the following Dataframe Empdf from a Dictionary: (3)
EName Salary
0 Kush 10000
1 Ruchika 12000
2 Divya 20000
3 John 25000
(ii) Write python code to display the Ename and Salary having Salary more than 20000.
(iii) Write python code to add a column ‘Commission’ with values as 5% of the Salary.

Swati Dubey
Answer by Swati Dubey

The code to create the DataFrame and perform the requested operations is as follows:

import pandas as pd
# Dictionary for creating DataFrame
data = {'EName': ['Kush', 'Ruchika', 'Divya', 'John'],
'Salary': [10000, 12000, 20000, 25000]}
# Create DataFrame from dictionary
empdf = pd.DataFrame(data)
# Print DataFrame
# Display EName and Salary with Salary more than 20000
high_salary_df = empdf[empdf['Salary'] > 20000]
print(high_salary_df[['EName', 'Salary']])
# Add a column 'Commission' with values as 5% of the Salary
empdf['Commission'] = empdf['Salary'] * 0.05

This code will create the empdf DataFrame, display the EName and Salary for those with salaries greater than 20000, and add a new column named 'Commission' with values calculated as 5% of the Salary.

See more questions & answers

Ask a question about Advanced IP Scanner

Alternative downloads

Bonjour Print Services

Bonjour Printer Wizard lets you configure printers from your computer.

Advanced Port Scanner

Retrieves versions of programs running on the detected ports.

Colasoft MAC Scanner

Identify the devices that are connected to a Local Subnet.