引入相关包
import numpy as np
import pandas as pd
from pandas import Series,DataFrame
import matplotlib.pyplot as plt
创建
s1 = Series(np.random.randn(10)).cumsum()
s2 = Series(np.random.randn(10)).cumsum()
s = Series([1,2,3,4,5])
print(s.cumsum())#累加
绘图s1
s1.plot()
kind参数控制图形的类型
#kind 参数
s1.plot(kind = 'bar',)
gride显示网格
#gride 显示网格,label = s1
s1.plot(kind = 'line',grid =True,label = 'S1',title = 'THIS IS SERIES')
s2.plot(kind = 'line',grid =True,label = 'S2',title = 'THIS IS SERIES')
plt.legend()
fig,ax = plt.subplots(2,1)
s1.plot(ax=ax[0],label = 'S1',kind = 'bar')
plt.legend()
s2.plot(ax=ax[1],label = 'S2')
plt.legend()