Skip to content

Commit 3db5147

Browse files
committed
Create 177. Nth Highest Salary.py
1 parent 3d2b663 commit 3db5147

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pandas as pd
2+
3+
def getNthHighestSalary(employee: pd.DataFrame, N: int) -> pd.DataFrame:
4+
unique_salaries = employee['salary'].drop_duplicates().nlargest(N)
5+
if len(unique_salaries) < N:
6+
return pd.DataFrame({"getNthHighestSalary(N)": [None]})
7+
return pd.DataFrame({"getNthHighestSalary(N)": [unique_salaries.iloc[-1]]})

0 commit comments

Comments
 (0)