首页 > 解决方案 > 获取矩阵python中每列大于阈值用户的元素的行名

问题描述

我是python新手,请你帮帮我。

在此处输入图像描述

我已读入一个 xlsx 文件并向其中添加了标题

header = ['S.No', 'Name', 'Science', 'english','History','art','Maths']

df = pd.read_excel('matrix.xlsx',  header=None, names=header)

我想提取达到85及以上的学生,我希望它看起来像这样:

roy[history,art,maths]
john[art,maths]
dave[art,math]

这是excel文件看起来如何帮助的代码

  p = pd.DataFrame.from_items([('Roy', [80, 75, 85, 90, 95]), ('John', [75, 80, 75, 85, 100]), ('Dave', [80, 80, 80, 90, 95, ])],
               orient='index', columns=['Science', 'English', 'History', 'Arts', 'Maths'])

谢谢

标签: python-3.x

解决方案


推荐阅读