快捷搜索:  汽车  科技

pandas画椭圆(10分钟Pandas教程绘图Plotting)

pandas画椭圆(10分钟Pandas教程绘图Plotting)ts = ts.cumsum() In [6]:<matplotlib.axes._subplots.AxesSubplot at 0xb554d70> In [5]:ts.head() Out[3]:1986-06-12 -1.431928 1986-06-13 -2.044595 1986-06-14 -0.551905 1986-06-15 -0.355231 1986-06-16 -0.083786 Freq: D dtype: float64 In [4]:ts.plot() Out[4]:

10分钟Pandas教程 绘图 Plotting

In [1]:

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

1. Series绘图

In [2]:

ts = pd.Series(np.random.randn(999) index = pd.date_range('6/12/1986' periods = 999))

In [3]:

ts.head()

Out[3]:

1986-06-12 -1.431928 1986-06-13 -2.044595 1986-06-14 -0.551905 1986-06-15 -0.355231 1986-06-16 -0.083786 Freq: D dtype: float64

In [4]:

ts.plot()

Out[4]:

<matplotlib.axes._subplots.AxesSubplot at 0xb554d70>

pandas画椭圆(10分钟Pandas教程绘图Plotting)(1)

In [5]:

ts = ts.cumsum()

In [6]:

ts.plot()

Out[6]:

<matplotlib.axes._subplots.AxesSubplot at 0xc659c90>

pandas画椭圆(10分钟Pandas教程绘图Plotting)(2)

2. DataFrame绘图

在DataFrame上,plot()方法可以方便地为所有列绘图。

In [7]:

df = pd.DataFrame(np.random.randn(999 4) index = ts.index columns = ['A' 'B' 'D' 'E'])

In [8]:

df = df.cumsum()

In [9]:

df.plot()

Out[9]:

<matplotlib.axes._subplots.AxesSubplot at 0xd6be9d0>

pandas画椭圆(10分钟Pandas教程绘图Plotting)(3)

pandas画椭圆(10分钟Pandas教程绘图Plotting)(4)

Pandas 绘图

猜您喜欢: