【问题标题】:Trouble analysing spreadsheet using pandas python [closed]使用pandas python分析电子表格时遇到问题[关闭]
【发布时间】:2019-12-07 20:22:06
【问题描述】:

我试图找到一种方法来比较学生在 InternalAssessment_Performance 和 FinalExam_Performance 中的一致表现。本质上,我需要在这两列中找到哪些学生有相同的答案。 如何比较两个公共的值并在它们相同时返回它们? 任何帮助,无论多小都会很棒。

【问题讨论】:

标签: python pandas pandas-groupby spreadsheet


【解决方案1】:

如果列对齐,您可以执行以下操作:

df[df['InternalAssessment_Performance'] == df['FinalExam_Performance']]

【讨论】:

  • 是的,这很完美,谢谢,可以说我也需要将它与更多列进行比较。我可以简单地添加更多'=='吗?
  • 是的,用括号添加它们:像这样:df[(df['InternalAssessment_Performance'] == df['FinalExam_Performance']) & (df['another'] == df['anotherone '])]
猜你喜欢
  • 1970-01-01
  • 2013-02-25
  • 2021-03-28
  • 1970-01-01
  • 2013-12-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多