1
我有一個熊貓數據集,我對兩列regions
和total_count
感興趣。如何從數組中創建陰謀離線圖表?
def print_row(regionCount):
print regionCount['region']
print regionCount['total_count']
regionCount.apply(print_row, axis = 1)
輸出看起來如下:
Fribourg
376
Vallis
608
...
在整個數據集,有與它們對應的TOTAL_COUNT 20米的區域。我想要描述酒吧欄的名稱和酒吧的高度。我怎樣才能建立一個圖表,從名單中獲取這些值,名稱爲regionCount
?
在下面的代碼,我想代替術語:food
,service
,environment
,也是數字:3.4
,4.2
,4.3
與regionCount['region'][0...end_of_regionCount]
和regionCount['total_count'][0...end_of_regionCount]
分別。
plotly.offline.plot({
"data": [
plotly.graph_objs.Bar(x=['food','service','environment'],y=
[3.4,4.2,4.3])
],
'layout': {'title': 'distribution',
'font': dict(family='Arial', size=16)}},
auto_open=True, image = 'png', image_filename='plot_image',
output_type='file', image_width=800, image_height=600, filename='temp-plot.html', validate=False
)
請,平均每個職位只有一個問題。 –
已刪除。這是更多的一個修辭問題掛鉤第一個 –
它可以解決使用:[http://stackoverflow.com/questions/32926202/read-the-values-from-the-print-statement-array-to-create -a-餅圖(http://stackoverflow.com/questions/32926202/read-the-values-from-the-print-statement-array-to-create-a-pie-chart) –