0

[Data_Image_Part_1]

1

[Data_Imagine_Part_2]

2

[Column names and index name (forgot to add in image part 1]3
I am trying to figure out for this data set:

  1. How to find the major of the students whose FIDN is 30?
    My idea: df_test.get_value(30, 'Major')
    but I do not know if this is correct

  2. How can I sort all the students by their last name, then by their tuition amount?
    My idea: df_test.sort_values( ['LastName', 'tuition'] )
    but this does not work and outputs just the column names and index name :(

eshirvana
  • 23,227
  • 3
  • 22
  • 38
Ryan157
  • 1
  • 1

1 Answers1

0
  1. df_test[df_test["FIDN"] == 30]["Major"]
    OR: df_test.loc[df_test["FIDN"] == 30]["Major"]
    https://stackoverflow.com/a/17071908/9169359

  2. df_test.sort_values(by=["LastName", "tuition"], ascending=False)
    https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sort_values.html

Niels Henkens
  • 2,553
  • 1
  • 12
  • 27
crkaz
  • 38
  • 9