0

HOW CAN I GET SECOND LARGEST VALUE IN A DATASET ... (python )

HOW can i print second largest value in a data frame without using index .. ex data set1...( columns) , salary, department, employee id data set2( column), salary, department, employee id after marge we creat another dataset 3 now how can find the second largest value with all departments ... please suggest me note : follow me for further queries example: import pandas as pd dataset1 = pd.DataFrame({"employ id":["a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","a11","a12","a13","a14","a15"],"age":[21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"salary":[1100,1500,2000,2500,3500,4000,5000,6000,6500,6600,7000,7500,7800,7900,8000]}) dataset2=pd.DataFrame({"employ id":["a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","a11","b5","b6","b7","b8"],"department":["mar","fin","hr","hr","fin","mar","fin","mar","fin","hr","mar","fin","mar","hr","fin"]}) dataset3=pd.merge(dataset1,dataset2,on="employ id")

10th Jul 2019, 6:26 AM
facebook hacking
facebook hacking - avatar
7 Respostas
0
Please use only relevant tags in your question. Check link below to see how to sort pandas dataframe. https://thispointer.com/pandas-sort-rows-or-columns-in-dataframe-based-on-values-using-dataframe-sort_values/
10th Jul 2019, 8:02 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Have you read the article I posted at all? It has pretty detailed explanation. Which part is not clear? Can you post your code attempt here? (even though it won't run in sololearn playground, but it makes much easier to review and debug.) If you are not comfortable with pandas at all, then maybe you should first start with more basic stuff.
11th Jul 2019, 1:02 PM
Tibor Santa
Tibor Santa - avatar
0
By removing the largest. Getting the second largest as largest, and adding the removed largest back.
10th Jul 2019, 7:55 AM
Seb TheS
Seb TheS - avatar
0
how can do this?? can u explain??
11th Jul 2019, 11:22 AM
facebook hacking
facebook hacking - avatar
0
bro....i read ur all content but you don't clear my doubt , actually i waana get second largest value on the basic of salary with different different departments ....ex for ....hr department 2nd largest ... marketing department second largest and so on....i already done with index ...and using shorting the values...
11th Jul 2019, 1:05 PM
facebook hacking
facebook hacking - avatar
0
its done....
12th Jul 2019, 3:17 AM
facebook hacking
facebook hacking - avatar