This question is somewhat related to Visually separating bar chart clusters in pandas
I am reading and plotting the tmp.csv file:
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
with:
#!/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()
and I get:
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
and:

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?
I tried:
df.rename(index={‘nan’: “”})
However there is an assertion failing
assert(new_axis.is_unique)
Probably because there are multiple ‘nan’ indexing the df. Ideas?
-Thanks
Instead of modifying the
DataFrame, perhaps just change the matplotlib xtick labels: