18-numpy笔记-莫烦pandas-6-plot显示

代码

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


data = pd.Series(np.random.randn(1000),index=np.arange(1000))
data = data.cumsum()
data.plot()
plt.show()

  

结果

 

-------------------------------------------------------------------------

 

代码

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

data = pd.DataFrame(np.random.randn(1000,4), 
                index=np.arange(1000),
                columns = list("ABCD"))
data = data.cumsum()
print(data.head())
data.plot()
plt.show()

 

结果

 

-------------------------------------------------------------------------

 

代码

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

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', 'scater', 

ax = data.plot.scatter(x='A',y='B',color='DarkBlue', label='Class1')
data.plot.scatter(x='A',y='C',color='DarkGreen', label='Class2', ax = ax)

plt.show()

  

结果

-----------------------------------------------------------------------

 

posted @ 2018-09-09 16:31  路边的十元钱硬币  阅读(211)  评论(0编辑  收藏  举报