Pandas concat flips all my values in the DataFrame

后端 未结 3 1279
北恋
北恋 2021-01-29 06:31

I have a dataframe called \'running_tally\'

        list   jan_to  jan_from
0         LA    True      False
1         NY   False       True

I am

3条回答
  •  一生所求
    2021-01-29 06:56

    I don´t get the booleans flipped as you, but you can try this too:

    running_tally=running_tally.append(new_data,ignore_index=True)
    print(running_tally)
    

    Output:

      list jan_to jan_from
    0   LA   True    False
    1   NY  False     True
    2  HOU    NaN      NaN
    

    EDIT: Since the question was edited, you could try with:

    running_tally=running_tally.append(new_data,ignore_index=True).groupby('list',as_index=False).first()
    

提交回复
热议问题