当前位置: 首页 > >

excelµÄÊý¾Ýͨ¹ýpyechartsÉú³Éͼ±í£¬²åÈëppt

发布时间:

Ò»¡¢°²×°pyecharts,xlrd


Ö±½Ó²ÉÓÃpip install pyecharts£¬»á°²×°×îа汾£¬Ó¦¸ÃÊÇ1.2.1£¬ºÜ¶à½Ó¿ÚÒѾ­±ä»¯ÁË£¬ÕâÀﻹÊÇ°²×°À*æ±¾£¬ÇÒ²»ÐèÒªsslºÍhttpsÈÏÖ¤£¬ÃüÁîÈçÏÂ


pip install -i http://mirrors.aliyun.com/pypi/simple/ pyecharts==0.1.9.4 --trusted-host mirrors.aliyun.com ?


ÏîÄ¿ÍøÕ¾£ºhttp://pyecharts.herokuapp.com/


¶þ¡¢¶ÁÈ¡excel


import xlrd
import xlwt
class excel():
def read(xlsfile):
book = xlrd.open_workbook(xlsfile) # µÃµ½ExcelÎļþµÄbook¶ÔÏó£¬ÊµÀý»¯¶ÔÏó
sheet0 = book.sheet_by_index(0) # ͨ¹ýsheetË÷Òý»ñµÃsheet¶ÔÏó
sheet_name = book.sheet_names()[0] # »ñµÃÖ¸¶¨Ë÷ÒýµÄsheet±íÃû×Ö
sheet1 = book.sheet_by_name(sheet_name) # ͨ¹ýsheetÃû×ÖÀ´»ñÈ¡£¬µ±È»Èç¹ûÖªµÀsheetÃû×־ͿÉÒÔÖ±½ÓÖ¸¶¨
nrows = sheet0.nrows # »ñÈ¡ÐÐ×ÜÊý
ncols = sheet0.ncols # »ñÈ¡ÁÐ×ÜÊý
list = []
for i in range(nrows):
list.append([])
for j in range(ncols):
# print(sheet0.cell_value(i, j))
list[i].append(str(sheet0.cell_value(i, j)))
print(list)
return sheet_name,list



Èý¡¢Éú³Éͼ±í


def excel_to_bar():
sheet_name,list =excel.read(file_path)
name_list = []
data_list= []
for i in range(1,6):
name_list.append(list[i][1])
data_list.append(list[i][2])
print(name_list)
# ÎļþÃûºÍsheetÃû
mybar = Bar(get_fileName(file_path), sheet_name)
mybar.add(list[0][2], name_list, data_list)
mybar.show_config()
mybar.render(path="bar.html")

»áÉú³Ébar.html£¬Ö±½ÓÔÚä¯ÀÀÆ÷Öдò¿ª£¬ÈçÏ£º


?


ËÄ¡¢²åÈëppt


²åÈëÄÚÖÃä¯ÀÀÆ÷¿Ø¼þºÍ°´Å¥£¬½øÈëVBA±àÂë½çÃæ


Private Sub ToggleButton1_Click()
? ? WebBrowser1.Navigate ("file:///D:/Users/PycharmProjects/Cmd/cmd/excel_pyecharts/render.html")
End Sub


²Î¿¼ £ºhttps://blog.csdn.net/sinat_40801052/article/details/82556791


?


相关推荐


友情链接: