A | B | C | |
1 | =old=file("Orders_old.csv").import@ct() | /读旧文件 | |
2 | =new=file("Orders_new.csv").import@ct() | /读新文件 | |
3 | for old.len() | =cmp(old(A3),new(A3)) | /循环比较两个文件的同行的记录 |
4 | =@|B3 | //比较结果追加到B4中 | |
5 | =B4.count(~==0) | //一致的行数 | |
6 | =B4.count(~!=0) | //不一致的行数 |
TDATE,CLOSING,OPENING,HIGHEST,LOWEST,VOLUME 1/2/2020,3085.2,3066.34,3098.1,3066.34,29.25B 1/3/2020,3083.79,3089.02,3093.82,3074.52,26.15B 1/6/2020,3083.41,3070.91,3107.2,3065.31,31.26B 1/7/2020,3104.8,3085.49,3105.45,3084.33,27.66B 1/8/2020,3066.89,3094.24,3094.24,3059.13,29.79B
A | B | |
1 | =T("share_index.csv").sort(TDATE) | /读文件并排序 |
2 | =A1.group@i(CLOSING < CLOSING[-1]) | /指数上涨的记录分到同一组 |
3 | =A2.max(~.count()) | /取最大值 |
A | B | C | D | E | |
1 | Per_Code | in_out | Date | Time | Type |
2 | 1110263 | 1 | 2013-10-11 | 09:17:14 | In |
3 | 1110263 | 6 | 2013-10-11 | 09:17:14 | Break |
4 | 1110263 | 5 | 2013-10-11 | 11:38:21 | Return |
5 | 1110263 | 0 | 2013-10-11 | 11:43:21 | NULL |
6 | 1110263 | 6 | 2013-10-11 | 13:21:30 | Break |
7 | 1110263 | 5 | 2013-10-11 | 14:25:58 | Return |
8 | 1110263 | 2 | 2013-10-11 | 18:28:55 | Out |
A | B | C | D | E | F | |
1 | Per_Code | Date | In | Out | Break | Return |
2 | 1110263 | 10/11/2013 | 09:17:14 | 18:28:55 | 11:37:00 | 11:38:21 |
3 | 1110263 | 10/11/2013 | 09:17:14 | 18:28:55 | 13:21:30 | 14:25:58 |
A | B | |
1 | =T("attendance.xlsx").sort(Per_Code,Date,Time) | /取数据并按人员、日期、时间排序 |
2 | =A1.group@o((#-1)\7) | /每7条记录(按人员)分一组 |
3 | =A2.(~([1,7,2,3,1,7,5,6])) | /对每个组,取出当天的有序数据 |
4 | =A3.conj( [~.Per_Code,~.Date] |~.(Time).m([1,2,3,4]) |[~.Per_Code,~.Date] |~.(Time).m([5,6,7,8])) | /将组内数据整理成序列,并合并各组 |
5 | =create(Per_Code,Date,In,Out,Break,Return) | /创建空结果集 |
6 | >A5.record(A4) | /向结果集填入数据 |
7 | =file("result.xlsx").xlsexport@t(A5) | /输出成新xls |
Sender: Melody<Melody@bus.emory.edu> Receiver: Susan<Susan@google.com> Date: 1/14/2020 Content: Do you yahoo!? SBC Yahoo!DSL - Dow only @29.95per month! Sender: Tom<Tom@163.com> Receiver: rose<rose@163.com> Date: 2/24/2020 Content: IMPORTANT NOTICE: The information in this email(and any attachments) is confidential. If you are not the intended recipient, you must not use or disseminate the …
A | B | |
1 | =file("mail.txt").import@si() | /将文件读为行的集合 |
2 | =A1.select(~!="") | /去除空行 |
3 | =A2.group@i(~=="Sender:") | /以"Sender:"为标记将集合分组,每组是一条不定行的记录 |
4 | =A3.new(~(2):Sender,~(4):Receiver,date(~(6)):Date ,~.to(8,).concat():Content) | /将不定行记录整理成规范记录 |
5 | =A4.select(like@c(Receiver,"*"+arg_name+*") && Date>arg_begin && Date<=arg_end ) | /查询 |
A | B | C | D | E | |
1 | No=123 | ver=456 | Cos=789 | ||
2 | No=678 | ver=783 | No=900 | U=89 | |
3 | No=330 | Y=67 | ver=890 | Cos=311 | F=19 |
A | B | |
1 | =file("keyvalue.xlsx").xlsimport@w() | /行内的单元格组成小集合,多个小集合组成大集合 |
2 | =A1.conj() | /将两层集合合并为单层集合 |
3 | =A2.select(~) | /去掉空白格 |
4 | =A3.(~.split("=")) | /按=将每个单元格单元格拆分成2部分 |
5 | =A4.new(~(1):key,~(2):value) | /规范化记录,第1部分命名为key字段,第2部分命名为value字段 |
6 | =A5.select(key==arg_key) | /查询 |
A | B | C | D | E | F | |
1 | Mengniu Funds | 2017 | 3 | 58.2 | 364 | 300 |
2 | 8.5 | 50 | 200 | 100 | 400 | 200 |
3 | 182.6 | 76.3 | 43.7 | 28.5 | 16.4 | |
4 | 120 | 1.07 | 30 | 0.27 | 90 | 0.8 |
5 | 154 | 6 | 4 | |||
6 | =file("e:/result.xlsx") | =A6.xlsopen() | ||||
7 | =C6.xlscell("B2",1;A1) | =C6.xlscell("J2",1;B1) | =C6.xlscell("L2",1;C1) | |||
8 | =C6.xlscell("B3",1;D1) | =C6.xlscell("G3",1;E1) | =C6.xlscell("K3",1;F1) | |||
9 | =C6.xlscell("B6",1;[A2:F2].concat("\t")) | =C6.xlscell("H6",1;[A3:E3].concat("\t")) | ||||
10 | =C6.xlscell("B9",1;[A4:F4].concat("\t")) | =C6.xlscell("B11",1;[A5:C5].concat("\t")) | ||||
11 | =A6.xlswrite(B6) |
A | B | |
1 | =Orders=json(httpfile("http://127.0.0.1:6868/api/orders").read()) | /从http取数据 |
2 | =Employees=T("d:/Emp.csv") | /从csv取数据 |
3 | =join@1(Orders:o,SellerId;Employees:e,EId) | /关联 |
4 | =A3.group(e.Detp,o:dept.Client:client;sum(Amount):amt,count(1):cnt) | /分组汇总 |