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()
文章图片
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
文章图片
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()
文章图片
scatter plot.png 【Pandas|Pandas plot画图】Pandas学习教程来源请戳这里
推荐阅读
- Python数据分析(一)(Matplotlib使用)
- 混淆矩阵画图
- Figure|Figure 图像
- Pandas(数据清洗)
- pandas使用
- Python--matplotlib绘图可视化
- 一个不去画图的夜晚
- Pandas批量读取csv文件数据存入到Mysql中
- 用Pandas库实现MySQL数据库的读写
- #|学习笔记 | Ch05 Pandas数据清洗 —— 缺失值、重复值、异常值