Similar to Select multiple sections of rows by index in pandas, I have large dataframe, and there are a few indexes I am interested in viewing.
I have:
import pandas as pd
df = pd.DataFrame({'A':[0,1,2,3,4,5,6,7,8,9],'B':['a','b','c','d','e','f','g','h','i','j']},
index=range(10,20,))
and there are few indexes I want to see, list=[12,15,10,14]
so that I end up with:
A B
12 2 c
15 5 f
10 0 a
14 4 e
is there a command so that I can go:
df.iloc[[index isin list]]
as the value list is made from an earlier piece of code.
I tried:
df.loc[[ix]]
where ix=dm.iloc[250].sort_values()[:10].index
and is Int64Index([250, 1109, 427, 513, 678, 18, 697, 1075, 533, 739], dtype='int64')
to no avail.
suggestions welcomed!