Skip to content
Snippets Groups Projects
Select Git revision
  • 73881adf6fe3bd3bdd329d6cb69c54c71f704fe8
  • master default
  • object
  • develop protected
  • private_algos
  • cuisine
  • SMOTE
  • revert-76c4cca5
  • archive protected
  • no_graphviz
  • 0.0.2
  • 0.0.1
12 results

ModifiedMulticlass.py

Blame
  • Reading.py 1.09 KiB
    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    """
    Created on Fri Jun 19 17:24:31 2020
    
    @author: taopeng
    """
    
    import xlrd
     
    
    def excel_data(file):
            # 打开Excel文件读取数据
        data = xlrd.open_workbook(file)
        # 获取第一个工作表
        table = data.sheet_by_index(3)
        # 获取行数
        nrows = table.nrows
        # 获取列数
        ncols = table.ncols
        # 定义excel_list
        excel_list = []
        for row in range(1, nrows):
            myRow = []
            for col in range(ncols):
                # 获取单元格数据
                cell_value = table.cell(row, col).value
                # 把数据追加到excel_list中
                myRow.append(cell_value)
            excel_list.append(myRow)
        return excel_list
    
     
    mylist = excel_data('ourExcel.xlsx')
    for i in range(0,len(mylist)):
        if i < 5:
            print(mylist[i])
            
            
    
    
    #  we select client whose 18 < age < 50, that means bd 1950-2002
    import time
    for i in range(0,len(mylist)):
        if i < 5 and i >1:
            # myTime = timeArray = time.strptime(int(mylist[i][5]), "%Y-%m-%d %H:%M:%S")
            print(mylist[i])