尝试使用 np.loadtext 导入文件时,我不断收到错误“ValueError:第 1 行有 2 列的列索引 2 无效”。
这是我当前用于尝试导入文件的代码。
from google.colab import drive
drive.mount('/content/drive')
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
evo0_8f = '/content/drive/MyDrive/HR-Diagram/evo_0.8.txt'
evo0_8 = np.loadtxt(evo0_8f, skiprows=2, usecols=(1,2))
各列从零开始编号。你需要
usecols=(0,1)
。