pandas绘图

Posted 棍子哥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pandas绘图相关的知识,希望对你有一定的参考价值。

#encoding:utf8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randn(10,4),index=pd.date_range(\'2018/12/18\',
   periods=10), columns=list(\'ABCD\'))
plt.figure()
df.plot()
df = pd.DataFrame(3 * np.random.rand(4), index=[\'a\', \'b\', \'c\', \'d\'], columns=[\'x\'])
df.plot.pie(subplots=True)
plt.show()
#或者
#encoding:utf8
import pandas as pd
import numpy as np
from pylab import *
df = pd.DataFrame(np.random.randn(10,4),index=pd.date_range(\'2018/12/18\',
   periods=10), columns=list(\'ABCD\'))
df.plot()
df = pd.DataFrame(3 * np.random.rand(4), index=[\'a\', \'b\', \'c\', \'d\'], columns=[\'x\'])
df.plot.pie(subplots=True)
show()

 

 

以上是关于pandas绘图的主要内容,如果未能解决你的问题,请参考以下文章