KeyError:“ [Index(...')]都不在[列]中”

时间:2019-08-22 11:40:17

标签: python-3.x pandas

我正在将recordlinkage库与pandas一起使用。在第一步中,我创建了索引,参数为:

indexer = recordlinkage.Index()
indexer.block(fr.iloc[:, 2])
pairs = indexer.index(fr)

请注意,项目页面指示以下用法:

 indexer = recordlinkage.Index()
 indexer.block('orignal_link')
 candidate_links = indexer.index(dfA, dfB)

我将列标签替换为相同位置(.iloc)。它找不到任何列名。但是,当我专门询问列名时,得到以下输出:

Index(['_id', 'doi', 'orignal_link', 'title', 'authors', 'affiliation', 'citation', 'abstract', 'paper', 'references'], dtype='object')

无论如何,更换后产生的错误如下:

KeyError: "None of [Index([('https://aip.scitation.org/doi/full/10.1063/1.5097416', 'https://aip.scitation.org/doi/full/10.1063/1.5110298', 'https://aip.scitation.org/doi/full/10.1063/1.5096407', 'https://aip.scitation.org/doi/full/10.1063/1.5093609', 'https://aip.scitation.org/doi/full/10.1063/1.5094748', 'https://aip.scitation.org/doi/full/10.1063/1.5098007', 'https://aip.scitation.org/doi/full/10.1063/1.5095979', 'https://aip.scitation.org/doi/full/10.1063/1.5109249', 'https://iopscience.iop.org/article/10.1088/1367-2630/12/7/073006/meta')], dtype='object')] are in the [columns]"

如果找不到值,如何打印出来?

有帮助吗?

谢谢

0 个答案:

没有答案