Note that there are some explanatory texts on larger screens.

plurals
  1. POModify nan index in pandas
    primarykey
    data
    text
    <p>This question is somewhat related to <a href="https://stackoverflow.com/questions/13983498/visually-separating-bar-chart-clusters-in-pandas">Visually separating bar chart clusters in pandas</a></p> <p>I am reading and plotting the tmp.csv file:</p> <pre><code>pol1 pol2 pol3 perim 0.54 0.64 0.40 mst 0.08 0.12 0.12 treeadd 0.25 0.34 0.35 health 0.14 0.17 0.17 bisort 0.48 0.56 0.56 em3d 0.14 0.17 0.17 g721d 1.41 2.58 2.58 mesa 1.16 1.8 1.8 epic 1.82 2.43 2.43 jpege 1.18 1.68 1.68 gzip 1.15 1.43 1.45 vpr 0.19 0.24 0.24 gcc 0.82 1.11 1.15 mcf 0.05 0.05 0.05 crafty 0.67 1.17 1.17 </code></pre> <p>with:</p> <pre><code>#!/usr/bin/env python from pandas import * import matplotlib.pyplot as plt from numpy import zeros # Create original dataframe df = read_csv('tmp.csv',sep='\s') print df df.plot(kind='bar') plt.show() </code></pre> <p>and I get:</p> <pre><code> pol1 pol2 pol3 perim 0.54 0.64 0.40 mst 0.08 0.12 0.12 treeadd 0.25 0.34 0.35 health 0.14 0.17 0.17 bisort 0.48 0.56 0.56 em3d 0.14 0.17 0.17 nan NaN NaN NaN g721d 1.41 2.58 2.58 mesa 1.16 1.80 1.80 epic 1.82 2.43 2.43 jpege 1.18 1.68 1.68 nan NaN NaN NaN gzip 1.15 1.43 1.45 vpr 0.19 0.24 0.24 gcc 0.82 1.11 1.15 mcf 0.05 0.05 0.05 crafty 0.67 1.17 1.17 </code></pre> <p>and:</p> <p><img src="https://i.stack.imgur.com/MH31e.png" alt="enter image description here"></p> <p>Note the separation of the clusters with the empty lines. This is the effect I want. Is there a way to replace the 'nan' label with "" in the x-axis?</p> <p>I tried: df.rename(index={'nan': ""})</p> <p>However there is an assertion failing</p> <pre><code>assert(new_axis.is_unique) </code></pre> <p>Probably because there are multiple 'nan' indexing the df. Ideas?</p> <p>-Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload