-2

I was given a task where I'm supposed to find largest value in 'Salary' column and print the value.

Here's the code:

    import numpy as np
    import pandas as pd 
    # TODO: Find the largest number in 'Salary' column
    
    data_one = pd.read_excel("C:\\Users\\HP\\Documents\\DataScience task\\Employee.xlsx")
    dataframe_data = pd.DataFrame(data_one)
    find_largest_salary = dataframe_data['Salary']

Output:

    First Name  Last Name   Gender  Age Experience (Years)  Salary
0   Arnold  Carter  Male            21  10                   8344

    1   Arthur  Farrell Male        20  7                    6437
    2   Richard Perry   Male        28  3                    8338
    3   Ellia   Thomas  Female      26  4                    8870
    4   Jacob   Kelly   Male        21  4                    548
    ... ... ... ... ... ... ...
    95  Leonardo    Barnes  Male    23  6                    7120
    96  Kristian    Mason   Male    21  7                    7018
    97  Paul    Perkins Male        21  6                    2929
    98  Justin  Moore   Male        25  0                    3141
    99  Naomi   Ryan    Female      22  10                   7486

The output I wanted (example):

99999
Henry Davis
  • 101
  • 1
  • 9
  • What do you mean "largest N value in 'Salary'"? Just [max](https://pandas.pydata.org/docs/reference/api/pandas.Series.max.html) -> `find_largest_salary = dataframe_data['Salary'].max()`? – Henry Ecker Dec 19 '21 at 04:47
  • Yes that what I want thank you – Henry Davis Dec 19 '21 at 04:49
  • Does this answer your question? [find 3 largest values in every column in data frame and get the index number python](https://stackoverflow.com/questions/53649374/find-3-largest-values-in-every-column-in-data-frame-and-get-the-index-number-pyt) – Shashikant R. Dhuppe Dec 19 '21 at 04:50

1 Answers1

1

the way you have described the question, the answer is simply this:

find_largest_salary = dataframe_data['Salary'].max()
ekrall
  • 192
  • 8