Plot with Pandas and matplotlib


In [4]:
import matplotlib
from matplotlib import pyplot as plt
plt.style.use('ggplot')
import pandas as pd
from pandas import Series, DataFrame
import numpy as np
import scipy as cp

Plot a Time Series


In [55]:
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))

In [51]:
ts.cumsum().plot ()


Out[51]:
<matplotlib.axes._subplots.AxesSubplot at 0x7ff156db6450>

In [ ]:
## Plot a Data Frame

In [61]:
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))

In [66]:
df.cumsum().plot ()


Out[66]:
<matplotlib.axes._subplots.AxesSubplot at 0x7ff156996050>

Bar Plot


In [92]:
ts = pd.Series(np.random.randint(10, size =1000))
ts.groupby (ts).count().plot.bar()


Out[92]:
<matplotlib.axes._subplots.AxesSubplot at 0x7ff14b93c310>