Python Forum
how do I return Max Test result + corresponding student name from an excel dataset?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do I return Max Test result + corresponding student name from an excel dataset?
#4
You should follow jefsummers advice.
(Jan-16-2022, 04:52 PM)jefsummers Wrote: show us your code, what you have done so far!
sean1 Wrote:yes in pandas, converted the excel file to list using pandas as pd
It should no be converted a list,maybe you mean DataFrame?
import pandas as pd

df = df.to_excel('file_name.xlsx', index=False)

Ok to show a example that can help,as you see it easy to make example code that other can run.
import pandas as pd
from io import StringIO

data = StringIO('''\
Movie,Year
The Godfather,1972
Seven,1995
Jaws,1975
Lawrence of Arabia,1962''')

df = pd.read_csv(data, sep=',')
# A DataFrame this is what all data that comes into Pandas become
>>> df
                Movie  Year
0       The Godfather  1972
1               Seven  1995
2                Jaws  1975
3  Lawrence of Arabia  1962
>>> 
>>> year_max = df['Year']
>>> year_max.max()
1995
>>> 
>>> # To get max value and whole row
>>> year = df[df['Year']==df['Year'].max()]
>>> year
   Movie  Year
1  Seven  1995
sean1 likes this post
Reply


Messages In This Thread
RE: how do I return Max Test result + corresponding student name from an excel dataset? - by snippsat - Jan-16-2022, 09:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  This result object does not return rows. It has been closed automatically dawid294 6 1,089 Mar-30-2024, 03:08 AM
Last Post: NolaCuriel
  How to test and import a model form computer to test accuracy using Sklearn library Anldra12 6 3,144 Jul-03-2021, 10:07 AM
Last Post: Anldra12
  How do I split a dataset into test/train/validation according to a particular group? 69195Student 1 2,291 May-12-2021, 08:27 PM
Last Post: bowlofred
  Generate questions from excel to test my chatbot mcubac08 5 2,875 Sep-01-2020, 06:15 PM
Last Post: mcubac08
  How to write test cases for a init function by Unit test in python? binhduonggttn 2 3,133 Feb-24-2020, 12:06 PM
Last Post: Larz60+
  How to write test cases by Unit test for database configuration file? binhduonggttn 0 2,569 Feb-18-2020, 08:03 AM
Last Post: binhduonggttn
  test pattern and add result in a table sam1975 1 1,918 Mar-05-2019, 02:41 PM
Last Post: sam1975
  python code (embedded in Redshift) to return result of the query Mel 0 2,463 Aug-24-2018, 06:12 PM
Last Post: Mel
  Multiple "return" statements or "result" variable? WolfWayfarer 7 7,794 Jul-25-2018, 07:51 AM
Last Post: perfringo
  get specific items from result return info mamoman 3 3,107 Jul-22-2018, 12:46 PM
Last Post: mamoman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020