Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Creating a Child Dataframe From Parent DataFrame on the basis of Index Of Parent DataFrame

I have a DataFrame Like:

    df4 = pd.DataFrame({'D': ['2', '4', '6', '8','10'],'E': ['1', '3', '5', '7','9']
                     ,'F': ['11', '33', '55', '77','99']})

df4 is My Parent DataFrame Now I Have To Create a DataFrame and the index given to me is indices:[0,3,4] So My Child DataFrame Should Look Like this:

    D   E   F
    2   1   11
    8   7   77
    10  9   99

My Approach Was

    for i in range(0,len(indices)):

        df=final_df.loc[indices[i]].values

But df is storing only last row Value

Comments