| 1234567891011121314151617181920212223242526272829 |
- # View more python tutorials on my Youtube and Youku channel!!!
- # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
- # Youku video tutorial: http://i.youku.com/pythontutorial
- """
- Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
- """
- from __future__ import print_function
- import pandas as pd
- import numpy as np
- import matplotlib.pyplot as plt
- # plot data
- # Series
- data = pd.Series(np.random.randn(1000), index=np.arange(1000))
- data = data.cumsum()
- ##data.plot()
- # DataFrame
- data = pd.DataFrame(np.random.randn(1000, 4), index=np.arange(1000), columns=list("ABCD"))
- data = data.cumsum()
- # plot methods:
- # 'bar', 'hist', 'box', 'kde', 'area', scatter', hexbin', 'pie'
- ax = data.plot.scatter(x='A', y='B', color='DarkBlue', label="Class 1")
- data.plot.scatter(x='A', y='C', color='LightGreen', label='Class 2', ax=ax)
- plt.show()
|