I Want You

这里有个简单的小问题,要求你用Python或Java解决它。

解决他,你将有机会和阿尔法工场研究院创始人欧阳长征先生共进午餐。

解决他,你将有机会和AlphaForce团队共同开创数据赋能上市公司的新篇章。

存在以下表和数据记录:

表EntityA

aid aname
1 Aaa1
2 Aaa2
3 Aaa3

表EntityB

bid bname
1 Baa1
2 Baa2
3 Baa3
4 Baa4
5 Baa5
6 Baa6
7 Baa7

表RecordX

bid time
7 2018-10-24 00:00:00
6 2012-11-02 00:00:00
2 2017-06-29 00:00:00
1 2018-04-13 00:00:00
1 2019-08-20 00:00:00
6 2019-08-26 00:00:00
4 2015-05-15 00:00:00
6 2012-10-09 00:00:00
4 2019-11-13 00:00:00
5 2017-03-01 00:00:00
1 2019-08-25 00:00:00
7 2019-10-28 00:00:00
5 2019-06-24 00:00:00
5 2016-11-01 00:00:00
2 2019-11-13 00:00:00
5 2019-11-07 00:00:00
3 2019-04-25 00:00:00
2 2018-01-04 00:00:00
3 2018-10-23 00:00:00
5 2019-11-01 00:00:00
1 2012-09-12 00:00:00
5 2019-10-28 00:00:00
2 2019-07-29 00:00:00
5 2018-10-15 00:00:00
1 2016-10-31 00:00:00
7 2019-04-24 00:00:00
2 2018-10-15 00:00:00
1 2011-08-26 00:00:00
2 2016-09-19 00:00:00
3 2019-11-13 00:00:00
2 2015-04-20 00:00:00
5 2018-07-30 00:00:00
7 2016-08-25 00:00:00

表RecordY

aid bid time
2 1 2019-11-11 00:00:00
1 2 2019-08-27 00:00:00
2 2 2011-03-31 00:00:00
3 7 2011-03-07 00:00:00
3 3 2010-07-30 00:00:00
1 1 2014-08-27 00:00:00
3 5 2019-10-31 00:00:00
3 5 2016-08-12 00:00:00
1 6 2010-05-13 00:00:00
2 7 2019-05-06 00:00:00
1 3 2018-10-16 00:00:00
1 5 2011-01-10 00:00:00
2 1 2010-04-26 00:00:00
2 2 2016-08-12 00:00:00
2 4 2019-08-27 00:00:00
1 6 2016-08-12 00:00:00
1 6 2018-10-16 00:00:00
3 6 2019-10-30 00:00:00
2 3 2010-11-01 00:00:00
2 6 2019-10-31 00:00:00
2 1 2010-03-26 00:00:00
1 5 2018-05-11 00:00:00
1 5 2016-07-11 00:00:00
3 2 2019-04-30 00:00:00
3 2 2014-08-04 00:00:00
1 3 2019-10-30 00:00:00
3 7 2010-10-13 00:00:00
1 6 2018-05-02 00:00:00
1 1 2014-06-30 00:00:00
1 4 2018-09-17 00:00:00
2 2 2019-10-30 00:00:00
1 6 2018-04-10 00:00:00
1 7 2019-10-31 00:00:00
2 1 2018-04-04 00:00:00
3 2 2010-03-23 00:00:00
2 3 2016-06-21 00:00:00
3 5 2008-07-03 00:00:00
2 3 2010-08-13 00:00:00
1 7 2016-05-23 00:00:00
2 1 2019-02-19 00:00:00
1 2 2019-10-30 00:00:00
2 2 2018-12-11 00:00:00
3 7 2014-06-10 00:00:00
3 3 2016-11-02 00:00:00
1 1 2019-08-27 00:00:00
3 5 2010-03-11 00:00:00
3 5 2018-04-03 00:00:00
1 6 2016-04-28 00:00:00
2 7 2014-05-19 00:00:00
1 3 2010-03-10 00:00:00
1 5 2016-04-27 00:00:00
2 1 2019-08-27 00:00:00
2 2 2010-03-08 00:00:00
2 4 2018-11-15 00:00:00
1 6 2014-05-03 00:00:00
1 6 2016-04-08 00:00:00
3 6 2007-08-06 00:00:00
2 3 2019-10-31 00:00:00
2 6 2010-03-08 00:00:00
2 1 2014-04-28 00:00:00
1 5 2017-11-06 00:00:00
1 5 2018-11-01 00:00:00
3 2 2007-06-14 00:00:00

要求对RecordX、RecordY按bid分类,按计数方式汇总;

用Z-Score的方法对汇总结果归一化;

并按1:2对归一化结果加权求平均得出factor。

表Result

aid bid factor
1 1 ?
1 2 ?
1 3 ?
1 4 ?
1 5 ?
1 6 ?
1 7 ?
2 1 ?
2 2 ?
2 3 ?
2 4 ?
2 5 ?
2 6 ?
2 7 ?
3 1 ?
3 2 ?
3 3 ?
3 4 ?
3 5 ?
3 6 ?
3 7 ?

对就是这么简单。

Come on!

把代码和结果发送到邮箱xuchangheng@arfgc.com

我们等着你!