df-drills pandas · Polars · DuckDB SQL · DuckDB Relational 题目列表 登录

常量填充

简单 05-null 缺失值 Nonefill

orders 表的 channel 列有缺失。把 channel 为 null 的值填成字符串 unknown,其余列保持不变。

  • 只填 channel:其他列(例如 customer_id、status、order_ts)里的 null 要原样保留。
  • 空字符串 "" 不是 null,保持为空字符串。

输入

  • orders(order_id, customer_id, order_ts, status, channel)

输出

列为 order_id, customer_id, order_ts, status, channel,行数与输入相同,行顺序不限。

输入表 (case base,共 2 个 case:base、edge)

orders shop/orders
#order_idint64customer_idint64order_tsdatetimestatusstringchannelstring
1 1001 39 2026-01-01 19:38:00 paid app
2 1002 16 2026-01-17 14:07:00 paid app
3 1003 4 2026-01-08 15:40:20 cancelled web
4 1004 2 2026-05-23 10:48:58 paid null
5 1005 12 2026-06-22 11:07:22 paid store
6 1006 17 2026-08-15 05:15:25 paid web
7 1007 9 2026-06-11 01:00:32 refunded store
8 1008 45 2026-09-19 20:47:10 paid web
9 1009 2 2025-10-05 04:53:38 paid app
10 1010 4 2026-02-19 01:39:54 paid app
11 1011 28 2026-03-05 03:04:45 refunded store
12 1012 2 2026-08-01 07:09:17 paid web
13 1013 26 2026-01-22 03:48:14 refunded store
14 1014 2 2026-02-09 01:41:41 paid app
15 1015 5 2026-08-03 19:49:04 refunded web
16 1016 26 2026-02-16 00:43:43 refunded app
17 1017 9 2025-12-06 04:48:57 pending app
18 1018 999 2026-05-19 12:13:43 paid store
19 1019 26 2026-02-05 15:02:26 paid store
20 1020 44 2025-11-24 11:19:00 cancelled web
显示前 20 行,共 200 行

期望输出 (case base,行顺序不限)

#order_idInt64customer_idInt64order_tsDatetime(time_unit='us', time_zone=None)statusStringchannelString
1 1001 39 2026-01-01 19:38:00 paid app
2 1002 16 2026-01-17 14:07:00 paid app
3 1003 4 2026-01-08 15:40:20 cancelled web
4 1004 2 2026-05-23 10:48:58 paid unknown
5 1005 12 2026-06-22 11:07:22 paid store
6 1006 17 2026-08-15 05:15:25 paid web
7 1007 9 2026-06-11 01:00:32 refunded store
8 1008 45 2026-09-19 20:47:10 paid web
9 1009 2 2025-10-05 04:53:38 paid app
10 1010 4 2026-02-19 01:39:54 paid app
11 1011 28 2026-03-05 03:04:45 refunded store
12 1012 2 2026-08-01 07:09:17 paid web
13 1013 26 2026-01-22 03:48:14 refunded store
14 1014 2 2026-02-09 01:41:41 paid app
15 1015 5 2026-08-03 19:49:04 refunded web
16 1016 26 2026-02-16 00:43:43 refunded app
17 1017 9 2025-12-06 04:48:57 pending app
18 1018 999 2026-05-19 12:13:43 paid store
19 1019 26 2026-02-05 15:02:26 paid store
20 1020 44 2025-11-24 11:19:00 cancelled web
21 1021 18 2026-06-29 17:32:41 refunded app
22 1022 1 2026-06-23 06:27:44 cancelled app
23 1023 46 2026-07-24 02:09:45 refunded web
24 1024 47 2026-02-26 18:42:02 paid unknown
25 1025 34 2026-07-05 07:41:49 cancelled web
26 1026 18 2025-11-24 08:15:00 paid web
27 1027 42 2026-05-22 08:52:21 paid web
28 1028 36 2026-01-12 18:12:02 paid app
29 1029 18 2026-03-03 14:01:10 paid web
30 1030 5 2026-06-12 16:22:09 paid store
31 1031 5 2026-02-14 10:30:00 paid app
32 1032 5 2026-02-14 13:30:00 paid web
33 1033 5 2026-02-14 16:30:00 paid store
34 1034 5 2026-02-14 10:30:00 paid app
35 1035 24 2025-12-25 18:50:00 refunded unknown
36 1036 14 2026-01-16 01:42:07 refunded app
37 1037 38 2026-03-08 19:28:41 pending store
38 1038 9 2025-12-18 09:01:58 paid store
39 1039 2 2025-09-12 08:26:19 paid web
40 1040 12 2026-02-11 15:04:00 cancelled web
41 1041 32 2026-04-22 15:13:08 paid app
42 1042 35 2025-10-28 14:44:18 cancelled web
43 1043 26 2026-01-05 21:57:00 paid store
44 1044 6 2026-02-09 18:36:53 paid store
45 1045 45 2026-01-23 07:06:47 cancelled web
46 1046 22 2026-06-30 01:58:03 paid web
47 1047 8 2026-01-09 09:26:50 paid app
48 1048 5 2025-12-14 00:07:09 paid app
49 1049 44 2026-07-31 23:48:12 paid app
50 1050 34 2026-01-05 17:34:00 refunded unknown
显示前 50 行,共 200 行