We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d53ec5 commit 4f87d74Copy full SHA for 4f87d74
0176-second-highest-salary/solution.py
@@ -0,0 +1,11 @@
1
+import pandas as pd
2
+
3
+def second_highest_salary(employee: pd.DataFrame) -> pd.DataFrame:
4
+ employee = employee.drop_duplicates(['salary'])
5
+ if len(employee['salary'].unique()) < 2:
6
+ return pd.DataFrame({"SecondHighestSalary" : [None]})
7
8
+ employee = employee.sort_values('salary', ascending=False)
9
+ employee.drop('id', axis=1, inplace=True)
10
+ employee.rename({'salary': 'SecondHighestSalary'}, axis=1, inplace=True)
11
+ return employee.head(2).tail(1)
0 commit comments