【发布时间】:2018-03-05 09:03:57
【问题描述】:
我正在使用 pandas 加载包含问题/答案的 csv 文件并将它们分配给 dict。
kids_csv_file = pd.read_csv(...) #columns Questions, SubQuestions, Answers
questions_dict = dict()
for i in ... :
_key = kids_csv_file.Questions[i] + '-' + kids_csv_file.SubQuestion[i]
questions_dict[_key] = kids_csv_file.Answers[i];
我得到:
TypeError: 必须是 str,而不是 numpy.int64
【问题讨论】:
-
欢迎来到 StackOverflow。请花时间阅读how to provide a great pandas example 上的这篇文章以及如何提供minimal, complete, and verifiable example 并相应地修改您的问题。 how to ask a good question 上的这些提示也可能有用。