要求:使用loc,和 iloc,实现条件切片读取数据源“meal_order_detail.xlsx"或"meal_order_detaill.aql",使用条件表达式,返回某一特定条件下的所有值。
import pandas as pd
detail = pd.read_excel('D:/AAA学习/数据分析/2022.11.9/meal_order_detail.xlsx')
order_id = detail['order_id']
dishes_name = detail.dishes_name
dishes_name1 = detail.loc[:, 'dishes_name']
dishes_name2 = detail.iloc[:, 3]
orderDish1 = detail.loc[:, ['order_id', 'dishes_name']]
orderDish2 = detail.iloc[:, [1, 3]]
# loc内部传入表达式
print('detail中order_id为458的dishes_name为: \n', detail.loc[detail['order_id'] == '1', ['order_id', 'dishes_name']])
请问这怎么解决