Skip to content

Commit 0076e79

Browse files
author
Mofan Zhou
committedJul 15, 2016
create pd 18
1 parent 4065127 commit 0076e79

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎numpy&pandas/18_plot.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# View more python tutorials on my Youtube and Youku channel!!!
2+
3+
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
4+
# Youku video tutorial: http://i.youku.com/pythontutorial
5+
6+
"""
7+
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
8+
"""
9+
import pandas as pd
10+
import numpy as np
11+
import matplotlib.pyplot as plt
12+
13+
# plot data
14+
15+
# Series
16+
data = pd.Series(np.random.randn(1000), index=np.arange(1000))
17+
data = data.cumsum()
18+
##data.plot()
19+
20+
# DataFrame
21+
data = pd.DataFrame(np.random.randn(1000, 4), index=np.arange(1000), columns=list("ABCD"))
22+
data = data.cumsum()
23+
# plot methods:
24+
# 'bar', 'hist', 'box', 'kde', 'area', scatter', hexbin', 'pie'
25+
ax = data.plot.scatter(x='A', y='B', color='DarkBlue', label="Class 1")
26+
data.plot.scatter(x='A', y='C', color='DarkGreen', label='Class 2', ax=ax)
27+
28+
plt.show()

0 commit comments

Comments
 (0)