[Python] Cannot reset_index inplace on a Series to create a DataFrame

Discussão em 'Python' iniciado por Stack, Setembro 13, 2021.

  1. Stack

    Stack Membro Participativo

    When I am trying to reset the index of my dataFrame, it is not working.

    new = pd.DataFrame(columns=['a','b','Amount1'])
    new['Amount1'] = [0,1,6,7,8,9]
    new['a'] = ['sarim',1,2,3,4,'sarim']


    df_tf = new[new['a']=='sarim']['Amount1']
    df_tf.reset_index(inplace=True)

    ret_df['Amount1'] = df_tf

    Continue reading...

Compartilhe esta Página