weixin_45747384
冫水❤少爺
2020-08-18 21:10
采纳率: 100%
浏览 121

想把列表中俩列分别赋值到x和y,再对x和y分别对应做运算

import xlrd as xd
import numpy as np
from minepy import MINE

data =xd.open_workbook (r'C:\Users\dengm\Desktop\text1.xls') #打开excel表所在路径
sheet = data.sheet_by_name('sheet1') #读取数据,以excel表名来打开
list = []
for r in range(sheet.nrows): #将表中数据按行逐步添加到列表中,最后转换为list结构
data1 = []
for c in range(sheet.ncols):
data1.append(sheet.cell_value(r,c))
list.append(list(data1))

x1,x2,x3,...,xk = list[i:i+k] #默认i=0,k=len(List)
y1,y2,y3,...,yk = list[i:i+k] #默认i=0,k=len(List)
mine = MINE(alpha=0.6, c=15)
mine.compute_score(xk, yk)

print("Without noise:")
print("MIC", mine.mic())

print(xk)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐