最近在研究螺纹钢与铁矿石的比价变化,所以用python写个代码分析一下。
数据文件:


数据下载自网络。
代码:

中间有些没用的,看官们请忽略,那是我从另一个文件直接复制来的,后面要plt出图的。
今天的文章只讲两个DataFrame如何连接到一起,相当于SQL的left-join ,或者update A left join B ON key1=key2。
控制台输出:

好了, 数据已经按日期关联到一起,后面就简单了,准备用matplotlib画3条拆线,观察历史相关性。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。