只是需要一些帮助,将excel电子表格矩阵转换为python的networkx模块可读的表单。我试过使用xlrd,但我不知道。请帮忙,如果我需要更具体的问题请告诉我。 到目前为止,我使用的代码是:
import xlrd
loc = 'C:\Users\kchen\Desktop\UNSW UNI\Honours\Publishing papers\EVC\Brain matrix\brain 1 matrix.xlsx'
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
sheet.cell_value(0, 0)
assert isinstance(sheet.nrows, object)
print(sheet.nrows)
loc = 'C:\Users\kchen\Desktop\UNSW UNI\Honours\Publishing papers\EVC\Brain matrix\brain 1 matrix.xlsx'
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
# For row 0 and column 0
sheet.cell_value(0, 0)
# Extracting number of columns
print(sheet.ncols)
目前没有回答
相关问题 更多 >
编程相关推荐