1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nana76 [90]
3 years ago
5

Write a program that, given a file name typed by the user, reads the content of the file and determines the highest salary, lowe

st salary and average salary. The file contains employee records, and each record consists of the hours worked and the hourly rate. The salary is calculated as the product of the hours worked and the hourly rate.
An example of file containing three records is as follows:
10.5 25.0
40.0 30.0
30.9 26.5
Computers and Technology
1 answer:
Oduvanchick [21]3 years ago
4 0

Using the pandas packge in python, the program which performs the required calculation goes thus :

file_name = input()

<em>#user</em><em> </em><em>types</em><em> </em><em>the</em><em> </em><em>filename</em><em> </em>

df = pd.read_csv(file_name, names=['hours_worked', 'rate']

<em>#file</em><em> </em><em>is</em><em> </em><em>read</em><em> </em><em>into a</em><em> </em><em>pandas</em><em> </em><em>dataframe</em><em> </em>

df['salary'] = df['hours_worked'] * df['rate']

<em>#salary</em><em> </em><em>column</em><em> </em><em>is</em><em> </em><em>created</em><em> </em><em>using</em><em> </em><em>the</em><em> </em><em>product of</em><em> </em><em>rate</em><em> </em><em>and</em><em> </em><em>hours</em><em> </em><em>worked</em><em> </em>

highest_salary = df['salary'].max()

<em>#the</em><em> </em><em>max</em><em> </em><em>method</em><em> </em><em>returns</em><em> </em><em>the</em><em> </em><em>maximum</em><em> </em><em>value of a</em><em> </em><em>series</em><em> </em>

print('highest_salary)

lowest_salary = df['salary'].min()

<em>#the </em><em>min</em><em> method returns the </em><em>minimum</em><em> value of a series </em>

print('lowest_salary)

avg_salary = df['salary'].mean()

<em>#the </em><em>mean</em><em> method returns the </em><em>average</em><em> value of a series </em><em> </em>

print('avg_salary)

Learn more : brainly.com/question/25677416

You might be interested in
If you tap or click the increase font size button too many times and make the font size too big, you can tap or click the _____
ioda
You can click the ctrl and minus  button at the same time
7 0
4 years ago
When green, this signal means __________ A. yield to pedestrians and vehicles that are still in the intersection. B. you have th
Ivan
When green, the signal means D. all of the above.

A green traffic signal means that you have the right-of-way, but you must yield to pedestrians and vehicles already in the intersection. If you hesitate or slow down, you may cause an accident or hold up traffic behind you, so it is important that you move swiftly and carefully to avoid causing any problems.
4 0
3 years ago
Read 2 more answers
Four possible skills a person could have
cluponka [151]

Answer:

Active listening skills.

Genuine interest in others.

Flexibility.

Good judgment.

Explanation:

4 0
4 years ago
In December of 2009, hackers broke into computer systems and stole secret defense plans of the United States and South Korea. Th
svetlana [45]

Answer:

Cyberterrorism

Explanation:

Cyberterrorism is unlawful use and exploitation of computers and networks (internet) by an individual or a group.

This is done to carry out illegal activities that can cause serious harm to people, government or causing large scale damage to computer systems.

The motivation behind cyberterrorism is usually to achieve some political or ideological or personal objectives, to cause disruption and coercion in a community, to damage the security systems or other government programs thus causing "terror".

Cyberterrorism is done using internet to cause damage to other computer systems  by means of malicious software in order to create disruption, terror or stealing the sensitive information.

For example the cyber terrorists can steal confidential information of military department by attacking the security systems for some political gain just as the hackers stole secret defense plans of US and South Korea which was an act of cyberterrorism.

7 0
4 years ago
Select the correct answer from each drop-down menu. Which are the features of conditional formatting? Conditional formatting ena
Alexandra [31]
Answer: oracle planning data sheet.
3 0
4 years ago
Other questions:
  • The numbers on the bottom of a typical check represent all of the following EXCEPT?
    12·2 answers
  • What is the recommended size for bulleted text?
    5·2 answers
  • What is the best way to improve the following code fragment? if ((counter % 10) == 0) { System.out.println("Counter is divisible
    13·1 answer
  • What should a consultant recommend to meet this requirement?Universal containers assign its contact center agents to certain int
    12·1 answer
  • What is it called when an attacker convinces you to enter personal information at an imposter website after receiving an email f
    10·2 answers
  • What is data that originated in another program or format?
    7·1 answer
  • In remote areas,your gps device may lose reception. its good idea to have a
    13·1 answer
  • Complete the sentence.
    8·1 answer
  • What describes the current cloud landscape for business?
    12·1 answer
  • Describe the fundamental security policies outlined by PCI DSS, FISMA, and COBIT. In a subsequent paragraph, identify at least 2
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!