简体   繁体   中英

Data Mining on data using pandas and series in Python?

[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:(

  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM