import pandas as pd
def sales_person(sales_person: pd.DataFrame, company: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame:
try:
# 找到名为 "RED" 的公司的 com_id
red_company_id = company[company['name'] == 'RED']['com_id'].values[0]
# 找到与名为 "RED" 的公司相关的订单的销售人员
red_orders_sales_ids = orders[orders['com_id'] == red_company_id]['sales_id']
# 找到没有与 "RED" 公司相关的订单的销售人员
result = sales_person[~sales_person['sales_id'].isin(red_orders_sales_ids)]['name']
# 将 Series 转换为 DataFrame
result_df = result.to_frame(name='name')
return result_df
except IndexError:
# 当找不到匹配的公司时返回所有销售人员的列表
return sales_person[['name']]