I have a pandas dataframe, I'm using the df.style
object to make it highlight odd-numbered rows, so:
def highlight_oddRow(s):
return ['background-color: yellow' if s.name % 2 else '' for v in s]
table = pd.DataFrame(
{'a': [3,9,8,0,2], 'b': [5,95, 9, 25,5], 'c': [23,54, 2, 3,5], 'row': [1, 2, 3, 4, 5]})
with open ('out.html','w') as out:
print >> out, table.style.apply(highlight_oddRow, axis=1).render()
However, this always prints out the index. Is there a way to tell it not to do this?