Pandas|Pandas plot画图

import pandas as pd import numpy as np import matplotlib.pyplot as plt

Series
data = https://www.it610.com/article/pd.Series(np.random.randn(1000),index=np.arange(1000)) data = data.cumsum() data.plot() plt.show()

Pandas|Pandas plot画图
文章图片
Series plot.png DataFrame
data = https://www.it610.com/article/pd.DataFrame(np.random.randn(1000,4),index=np.arange(1000),columns=list("ABCD")) data = https://www.it610.com/article/data.cumsum() print(data.head()) data.plot() plt.show()ABCD 02.830178 -1.2667630.066207 -1.447268 12.304518 -0.2712370.858129 -1.317108 21.7951700.7861670.407461 -0.883278 31.3005441.8460250.8483250.076735 42.4898854.4993460.1776880.565535

Pandas|Pandas plot画图
文章图片
DataFrame plot.png plot methods:bar/hist/box/ked/area/scatter/hexbin/pie
abc = data.plot.scatter(x='A',y='B',color='DarkBlue',label='Class1') data.plot.scatter(x='A',y='C',color='DarkGreen',label='Class2',ax=abc) #同一个绘图窗口 plt.show()

Pandas|Pandas plot画图
文章图片
scatter plot.png 【Pandas|Pandas plot画图】Pandas学习教程来源请戳这里

    推荐阅读