How to use python to visualize the data in Excel in a page
Editor to share with you how to use python to visualize the data in Excel on the page, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
one。 Demand
Recently, our teacher of data visualization asked us to visualize the house price data in the historical house prices in Guangzhou, and then sent us the historical house prices in Guangzhou .xls, and then took a look at the data. Anyway, it was a bit difficult to copy and paste, so I wanted to use python to help me modify the data into what I copied with one click.
two。 Install the xlrd module pip install xlrd
Usually pip comes with it, so we can import xlrd it in the development tools.
Here are the ways to cut each month of the year
Import xlrdpath = ringing E:\ data Analysis\ 07 Historical House prices in Guangzhou .xls'# sheetName is the table in your excel file For example, Sheet1 (pay attention to the case problem) sheetName = 'Sheet1'data = xlrd.open_workbook (path) table = data.sheet_by_name (sheetName) # number of rows rowAmount = number of table.nrows# columns colAmount = table.ncols# display the contents of the possessive case in the nth column datas= [] for rowIndex in range (1Magna rowIndex): datas.append (table.cell_value (rowIndex, 1) datas.reverse () index1=0index2=12time=2009while index2