1. 程式人生 > >18-numpy筆記-莫煩pandas-6-plot顯示

18-numpy筆記-莫煩pandas-6-plot顯示

pri das ali print 圖片 dom p s sum() 代碼

代碼

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()

  

結果

技術分享圖片

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

18-numpy筆記-莫煩pandas-6-plot顯示