In [1]:
import pandas as pd
import numpy as np
from pandas import DataFrame

plot_df = DataFrame(np.random.randn(100,2), columns=['x','y'])
plot_df.head(20)
Out[1]:
x y
0 -0.859584 0.756336
1 -0.128614 0.244516
2 -0.180215 0.262050
3 0.076480 -0.789597
4 -0.459032 -0.691748
5 0.451849 -1.087149
6 -1.280314 -0.189647
7 -0.074831 1.391770
8 0.345652 1.317929
9 -2.536633 0.646222
10 1.572306 -0.584983
11 -0.022376 0.308307
12 1.675047 0.532822
13 -1.683904 0.609653
14 1.870078 -0.975634
15 1.638483 -1.442473
16 -1.530614 -0.204387
17 -1.216783 0.930962
18 -0.730724 -0.382810
19 1.549956 1.065209
In [3]:
%pylab inline
plot_df.plot()
Populating the interactive namespace from numpy and matplotlib
Out[3]:
<matplotlib.axes._subplots.AxesSubplot at 0x106ba9450>
In [4]:
%pylab inline
plot_df2 = plot_df
plot_df2['y'] = plot_df2['y'].map(lambda x : x+1)
plot_df2.plot()
Populating the interactive namespace from numpy and matplotlib
Out[4]:
<matplotlib.axes._subplots.AxesSubplot at 0x106c01cd0>
In [5]:
%pylab inline
plot_df2.hist()
Populating the interactive namespace from numpy and matplotlib
Out[5]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x106d768d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x10710ab90>]], dtype=object)
In [2]:
%pylab inline
pd.Series([0,2,4,3,8]).plot()
Populating the interactive namespace from numpy and matplotlib
Out[2]:
<matplotlib.axes._subplots.AxesSubplot at 0x106b242d0>