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
Which of the following devices are least likely to deny a connection inline when an attack is detected? (select 2)
user100 [1]

Answer: Option (A) & (D) are correct.

Layer 2 switch is commonly referred to as a type of network or device switch that tends to work on data link layer and use MAC addresses in order to determine the route through which the frames are forwarded.

An IDS known as intrusion detection system is commonly referred to as a device or application that controls a network for malevolent activity and its policy violations.

7 0
3 years ago
What is the best free game designing program for windows
Nadusha1986 [10]
Python, Unity 3D, C++Notepad
8 0
3 years ago
What is the term for an element on a Webpage that contains data and procedures for how that item will react when activated
dezoksy [38]

Answer:

It is an object.  And this is because an object has the data and procedures that defines how it is going to react when it is going to be activated. The data is the details about the object, and it explains what the object actually is. And the procedures are the details of the functions that the particular objects can perform. Like for a hospital, data can be mentioning list of medication services they provide, and procedure can be like registering for any medication service, the complete process.

Explanation:

The answer is self explanatory.  

6 0
3 years ago
Write a sentence that describes how a series circuit works.
Lorico [155]

Answer:

In a series connection, the current is the same through each component regardless of any kind of components are used or their values. The voltage drops across each component in the circuit are dependent upon the values of the components used in the circuit. Another way to view a series connection is that the positive end of each component is connected to the negative end of the previous component in a 'one after the other' arrangement. The negative end of each component is also connected to the positive end of the next component.

It is one of which every component is arranged in a series connection. Hence series circuit will have same current at all points of the circuit. The voltage drop across each component in the circuit adds up to sum of voltage source across each component and of an equivalent component value. Breaking of the series circuit will make entire circuit to stop working. Suppose consider the three bulbs are connected in series connection and if even one bulb burns out or broken then all the three bulbs will stop working as well. In series circuit components like current (I) is sum of all the element and Voltage is sum of all the voltage drops and resistance is the sum of individual resistances.

Explanation:

3 0
3 years ago
What determines gravitational pull?<br><br> volume<br><br> mass<br><br> the sun<br><br> acceleration
Arte-miy333 [17]
C. The sun is correct!
8 0
3 years ago
Read 2 more answers
Other questions:
  • What type of camera is a cell phone camera
    14·2 answers
  • What are the commands used in windows 2012 to mount the nfs share on the linux server?
    8·1 answer
  • Andy, a developer, is designing a new program. Which tool should Andy use to help him complete his task?
    13·1 answer
  • Do you watch markiplier?
    13·2 answers
  • Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has three links, of rates R1 = 500 kbps, R2
    14·1 answer
  • What is missing in the following program in order to have the output shown?
    15·2 answers
  • It is usually simple to delete old posts and online conversations if they make you look bad.
    5·1 answer
  • 5. A Disk defragmenter tool does what to a computer HDD?
    6·1 answer
  • I need the solution to this task please anyone
    14·1 answer
  • What are logic gates ?​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!