मेरे पास एक पांडस डेटाफ्रेम है, और मैं इसे matplotlib तालिका के रूप में प्लॉट करना चाहता हूं। अब तक मैं उस भाग निम्न कोड के साथ काम किया है:matplotlib: रंग तालिका-सेल पृष्ठभूमि में एक रंगरूप का उपयोग
import numpy as np
randn = np.random.randn
from pandas import *
idx = Index(arange(1,11))
df = DataFrame(randn(10, 5), index=idx, columns=['A', 'B', 'C', 'D', 'E'])
vals = np.around(df.values,2)
fig = plt.figure(figsize=(15,8))
ax = fig.add_subplot(111, frameon=True, xticks=[], yticks=[])
the_table=plt.table(cellText=vals, rowLabels=df.index, colLabels=df.columns,
colWidths = [0.03]*vals.shape[1], loc='center')
table_props = the_table.properties()
table_cells = table_props['child_artists']
clm = cm.hot(vals)
for cell in table_cells:
cell.set_height(0.04)
# now i would like to set the backgroundcolor of the cell
इस के अंत में मैं रंग मैप के अनुसार सेल के पृष्ठभूमि रंग सेट करना चाहते हैं - लेकिन मैं कैसे यह clm में लग रहे हो एक सूचकांक के बिना सरणी?
एक और सवाल: क्या मैं किसी भी तरह तालिका में एक प्रारूप स्ट्रिंग पास कर सकता हूं, ताकि यह पाठ को दशमलव दशमलव पर स्वरूपित कर सके?
किसी भी संकेत की सराहना की, एंडी