python笔记:5.3.1_基本统计图形_pandas折线图_第二个y轴

 

# -*- coding: utf-8 -*-
"""
Created on Sat Jun  8 16:13:36 2019

@author: User
"""

import numpy as np
import pandas as pd
#import matplotlib as mpl
#import matplotlib.pyplot as plt
#import datetime

print('\n pd.read_table:')
jddf=pd.read_csv('data\stock50.csv',sep=',',header=None,
                   names=['id','time','code','open_p','close_p','low_p','vol','high_p','col'])

jddf['time']=jddf['time'].astype(np.str_)
jddf['time'] = pd.to_datetime(jddf['time'],format="%Y%m%d")
jddf=jddf.set_index('time')


#jddf[['open_p']].plot(use_index=True,grid=True)
jddf['close_p'].plot(use_index=True,grid=True)
jddf['vol'].plot(use_index=True,secondary_y=True,grid=True)

运行:

python笔记:5.3.1_基本统计图形_pandas折线图_第二个y轴_第1张图片

你可能感兴趣的:(python学习)