1#for single row
2df.loc[ index , : ]
3
4# for multiple rows
5indices = [1, 20, 33, 47, 52 ]
6new_df= df.iloc[indices, :]
1from pandas import DataFrame
2
3boxes = {'Color': ['Green','Green','Green','Blue','Blue','Red','Red','Red'],
4 'Shape': ['Rectangle','Rectangle','Square','Rectangle','Square','Square','Square','Rectangle'],
5 'Price': [10,15,5,5,10,15,15,5]
6 }
7
8df = DataFrame(boxes, columns= ['Color','Shape','Price'])
9
10select_color = df.loc[df['Color'] == 'Green']
11print (select_color)
12