import pandas as pd # 创建示例 DataFrame data = { 'A': [1, 2, 3, 4, 5], 'B': ['a', 'b', 'c', 'd', 'e'], 'C': [10, 20, 30, 40, 50] } df = pd.DataFrame(data) # 使用条件索引选择满足条件的行(例如:列 'A' 大于 2) selected_rows = df[df['A'] > 2] print(selected_rows)
标签:满足条件,rows,df,selected,DataFrame,索引 From: https://www.cnblogs.com/nicole-zhang/p/17613793.html