import pandas as pd from pandas import DataFrame,Series df = DataFrame([12,22,53,14,25,36,27,58,69,10],columns = ['A'],index = np.arange(0,100,10)) df.plot()
执行结果:
import pandas as pd import numpy as np from pandas import DataFrame,Series df = DataFrame(np.random.randn(4,2),columns = ['A','B'],index = np.arange(0,100,25))# 二维数组中4行2列,index 需要4个,100/25=4,x轴范围0~100 df.plot()
执行结果:
from pandas import Series,DataFrame s = Series([3,2,5,7,6,9,0,1,4,8],index=['a','b','c','d','e','f','g', 'h','i','j']) s.plot()
执行结果:
from pandas import Series,DataFrame df = DataFrame([[3,2,5,7,3],[0,1,4,8,3],[3,2,4,8,3], [6,9,4,8,3]],columns =['A','B','C','D','E'],index=['a','b','c','d']) df.plot(kind='bar')
执行结果: