请帮我补全代码 Create the ranges and labels for the wait_type column mentioned in the description. Create the wait_type column

动态 未结 0 131
小小草
小小草 LV1 2023年9月23日 23:40 发表
# Create ranges for categories label_ranges = [0, 60, 180, np.inf] label_names = ['short', 'medium', 'long'] # Create wait_type column airlines['wait_type'] = pd.cut(airlines['wait_min'], bins=label_ranges, labels=label_names) # Create mappings and replace mappings = {'Monday':'weekday', 'Tuesday':'weekday', 'Wednesday': 'weekday', 'Thursday': 'weekday', 'Friday': 'weekday', 'Saturday': 'weekend', 'Sunday': 'weekend'} airlines['day_week'] = airlines['day'].replace(mappings)
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复