此刻我有点吃惊,我开始质疑我的技能。
我有以下程序:
def readdata(mr_data):
mr = pd.read_csv(mr_data, sep = ",")
mrarray = mr.values
mranswers = {}
for j in mrarray:
#print(j) # until here it is correct and the values are different
if j[0] == 'Subject':
continue
if j[0] not in mranswers:
mranswers[j[0]] = {}
mranswers[j[0]][j[14]] = j[2]
print(mranswers) # here it is the same suddenly, for both datasets
这绝对没有任何意义。当我用两个不同的文件调用函数时,最后的值(对于mranswers)是相同的。但是,当我打印j时,它们实际上是不同的,这怎么可能发生,我该怎么做才能避免呢?