pandas-21 Series和Dataframe的画图方法
前言
在pandas中,无论是series还是dataframe都内置了.plot()方法,可以结合plt.show()进行很方便的画图。
Series.plot() 和 Dataframe.plot()参数
data : Series
kind : str
‘line’ : line plot (default)
‘bar’ : vertical bar plot
‘barh’ : horizontal bar plot
‘hist’ : histogram
‘box’ : boxplot
‘kde’ : Kernel Density Estimation plot
‘density’ : same as ‘kde’
‘area’ : area plot
‘pie’ : pie plot
指定画图的类型,是线形图还是柱状图等
label 添加标签
title 添加标题
……(后接一大堆可选参数)
详情请查阅:[官方文档传送门](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.plot.html?highlight=series plot#pandas.Series.plot)
Dataframe.plot()参数 也是大同小异:
详情请查阅:官方文档传送门
Series.plot()代码demo
import matplotlib.pyplot as plt
import pandas as pd
impo