How to store the data read from an excel sheet in to a list?

135 views
Skip to first unread message

Bhavya

unread,
Sep 24, 2017, 8:23:30 AM9/24/17
to Python GCU Forum

Hi,


I have tried to create a bar chart in python reading the data from an excel file, but getting new errors at each step.


Kindly help me in completing the task.


import xlrd

import matplotlib.pyplot as plt; plt.rcdefaults()

import numpy as np

import matplotlib.pyplot as plt


head=[]

val=[]

wb=xlrd.open_workbook("Test2.xlsx", on_demand=True)

s=wb.sheet_by_index(0)

head=s.row(0)

val=s.row(1)

width=1/1.5

plt.bar(range(0, len(head)),[row[1] for row in head], val, width, color="blue")

plt.show()


Test2.xlsx

North 4000
South 3000
East 6000
West 4500


Thanks and Regards

Bhavya


Reply all
Reply to author
Forward
0 new messages