Solution for How can I use iloc to extract rows of a dataframe to create a separate dataframe?
is Given Below:
I have a dataframe from which I would like to extract specific rows and create a separate dataframe consisting of those extracted rows.
The following is an example:
I have the row indices in an array called row_ind with values (0,2):
for i in range(len(df)) a = row_ind[i] b = df.iloc[a]
How can I use this to create the data set that I want?
foo =  for i in range(len(df)) a = row_ind[i] foo.append(a) newdf = df.iloc[foo]