绘制数据

Python 金融进阶

Kennedy Behrman

Data Engineer, Author, Founder

查看数据

股票价格图

Python 金融进阶
exxon.head()
Python 金融进阶

数据介绍

exxon.head()
    Date         High        Volume      Month
0   2015-05-01   90.089996   198924100   May
1   2015-06-01   85.970001   238808600   Jun
2   2015-07-01   83.529999   274029000   Jul
3   2015-08-01   79.290001   387523600   Aug
4   2015-09-01   75.470001   316644500   Sep

Python 金融进阶

Matplotlib

my_dataframe.plot()
Python 金融进阶

折线图

exxon.plot(x='Date', 
           y='High' )
Python 金融进阶

股票价格的折线图

Python 金融进阶

旋转

exxon.plot(x='Date', 
           y='High', 
           rot=90 )
Python 金融进阶

带旋转标签的折线图

Python 金融进阶

标题

exxon.plot(x='Date', 
           y='High', 
           rot=90, 
           title='Exxon Stock Price')
Python 金融进阶

带标题的折线图

Python 金融进阶

索引

exxon.set_index('Date', inplace=True)
exxon.plot(y='High', 
           rot=90, 
           title='Exxon Stock Price')
Python 金融进阶

用索引作横轴的折线图

Python 金融进阶

图表类型

  • line
  • bar
  • barh
  • hist
  • box
  • kde
  • density
  • area
  • pie
  • scatter
  • hexbin
Python 金融进阶

柱状图

exxon2018.plot(x='Month', 
               y='Volume', 
               kind='bar', 
               title='Exxon 2018')
Python 金融进阶

柱状图

Python 金融进阶

直方图

exxon.plot(y='High',kind='hist')
Python 金融进阶

直方图

Python 金融进阶

开始练习!

Python 金融进阶

Preparing Video For Download...