python: best way convey missing value count
<p>I currently have a data frame with 9 features and some features have missing values. I do the following to get the <code>count</code> of missing values in each feature:</p>

<pre><code>df.isnull().sum()
</code></pre>

<p>which gives me:</p>

<pre><code>A           0
B           0
C    15844523
D         717
E       18084
F      118679
G           0
H      978505
I           0
</code></pre>

<p>I want to display this information in a nice way. I can always create a table in the report but is there any other way to display this in a plot?</p>

<p>I think you can use <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.log.html" rel="nofollow"><code>numpy.log</code></a> with <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.plot.bar.html" rel="nofollow"><code>Series.plot.bar</code></a>:</p>

<pre><code>import matplotlib.pyplot as plt

np.log(s).plot.bar()
plt.show()
</code></pre>

<p><a href="http://i.stack.imgur.com/XlAPA.png" rel="nofollow"><img src="http://i.stack.imgur.com/XlAPA.png" alt="log"></a></p>

<p>Another solution is categorize data to bins by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.cut.html" rel="nofollow"><code>cut</code></a> and then use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.plot.bar.html" rel="nofollow"><code>Series.plot.bar</code></a>:</p>

<pre><code>import matplotlib.pyplot as plt

#convert Series to one column df with column name 'name'
df = s.rename('name').to_frame()

bins = [-1,1, 10, 100, 1000,10000,100000,1000000,10000000, 100000000,np.Inf]
labels=[0,1,2,3,4,5,6,7,8,9]
df['label'] = pd.cut(df['name'], bins=bins, labels=labels)

print (df.label)
A    0
B    0
C    8
D    3
E    5
F    6
G    0
H    6
I    0
Name: label, dtype: category
Categories (10, int64): [0 &lt; 1 &lt; 2 &lt; 3 ... 6 &lt; 7 &lt; 8 &lt; 9]

df.label.astype(int).plot.bar()
plt.show()
</code></pre>

<p><a href="http://i.stack.imgur.com/jnBTw.png" rel="nofollow"><img src="http://i.stack.imgur.com/jnBTw.png" alt="binned graph"></a></p>

<p>I think it is nicer as plot column <code>name</code>:</p>

<pre><code>df.name.plot.bar()
plt.show()
</code></pre>

<p><a href="http://i.stack.imgur.com/cjS1G.png" rel="nofollow"><img src="http://i.stack.imgur.com/cjS1G.png" alt="orig"></a></p>

python python-2.7 pandas visualization data-visualization