# Below code only shows rows where the column 'D' values are greater than 5
data = pd.read_excel("TABLE.xlsx", usecols='D,E,F')
selected_rows = data[data['D'] > 5]
This is for selecting from D column.Similarly, use other indexing based on your requirement.
1条答案
按热度按时间bxpogfeg1#
还可以使用其他布尔运算符(〈、〉=、〈=、==、!=等)根据不同的条件选择行,并使用逻辑运算符(&、|,~)。
查看此链接以获得有关布尔索引Logical operators for Boolean indexing in Pandas的更多帮助