37.pandas plotting

import pandas as pd
df1 = pd.read_csv('../Inputs/df1', index_col=0)
df1
A B C D
2000-01-01 1.339091 -0.163643 -0.646443 1.041233
2000-01-02 -0.774984 0.137034 -0.882716 -2.253382
2000-01-03 -0.921037 -0.482943 -0.417100 0.478638
2000-01-04 -1.738808 -0.072973 0.056517 0.015085
2000-01-05 -0.905980 1.778576 0.381918 0.291436
... ... ... ... ...
2002-09-22 1.013897 -0.288680 -0.342295 -0.638537
2002-09-23 -0.642659 -0.104725 -0.631829 -0.909483
2002-09-24 0.370136 0.233219 0.535897 -1.552605
2002-09-25 0.183339 1.285783 -1.052593 -2.565844
2002-09-26 0.775133 -0.850374 0.486728 -1.053427

1000 rows × 4 columns

df1['A'].hist()
<matplotlib.axes._subplots.AxesSubplot at 0x7fae41c46090>
df1['A'].hist(bins=30)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae603f0e90>
df1['A'].hist(bins=50)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae60407610>
df1['A'].hist(bins=100)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae41c46650>
df1['A'].plot.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x7fae305f4bd0>
df1['A'].plot(kind='hist', bins= 30)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae422313d0>
df2 = pd.read_csv('../Inputs/df2')
df2
a b c d
0 0.039762 0.218517 0.103423 0.957904
1 0.937288 0.041567 0.899125 0.977680
2 0.780504 0.008948 0.557808 0.797510
3 0.672717 0.247870 0.264071 0.444358
4 0.053829 0.520124 0.552264 0.190008
5 0.286043 0.593465 0.907307 0.637898
6 0.430436 0.166230 0.469383 0.497701
7 0.312296 0.502823 0.806609 0.850519
8 0.187765 0.997075 0.895955 0.530390
9 0.908162 0.232726 0.414138 0.432007
df2.plot.area(alpha=0.4)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae4249cd10>
df2.plot.bar()
<matplotlib.axes._subplots.AxesSubplot at 0x7fae7055f510>
df2.plot.bar(stacked=True)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae4310b050>
df2.plot.line(x='a', y='b')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae433cb9d0>
df2.plot.line(y='a')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae43629a50>
df1.plot.line(y='A', lw=0.3)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae440f5d50>
df1.plot.line(y='A', lw=0.5)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae43d36890>
df2.plot.scatter(x='a', y='b')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae70353510>
df1.plot.scatter(x='A', y='B')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae441aa050>
df1.plot.line(x='A', y='B')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae43e60410>
df2.plot.pie(y='a')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae434e7e10>
df2.plot.box()
<matplotlib.axes._subplots.AxesSubplot at 0x7fae43c0b4d0>
df1.plot.hexbin(x='A', y='B')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae50d7dcd0>
df1.plot.hexbin(x='A', y='B', gridsize=25)
<matplotlib.axes._subplots.AxesSubplot at 0x7fae4436f190>
df1.plot.hexbin(x='A', y='B', gridsize=25, cmap='coolwarm')
<matplotlib.axes._subplots.AxesSubplot at 0x7fae311b5990>
# kernel density plot
df2['a'].plot.kde()
<matplotlib.axes._subplots.AxesSubplot at 0x7fae31505210>
df2.plot.kde()
<matplotlib.axes._subplots.AxesSubplot at 0x7fae31538f50>