1873. 计算特殊奖金
为保证权益,题目请参考 1873. 计算特殊奖金(From LeetCode).
解决方案1
Python
python
import pandas as pd
def calculate_special_bonus(employees: pd.DataFrame) -> pd.DataFrame:
ans = pd.DataFrame({
"employee_id": employees["employee_id"],
"bonus": employees["salary"] * (employees["employee_id"] % 2 & ~employees["name"].str.startswith("M"))
})
ans = ans.sort_values("employee_id");
return ans;
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12