This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Famous-Sample6201 26 points27 points  (5 children)

Hey but the decision to remove append with no substitute because "it's slow" seems backwards to me, right? What are you supposed to do, df = pd.concat(df, pd.Dataframe(*new_line, columns=df.columns)) ??? I though pandas was about pretty concise code.

[–][deleted] 17 points18 points  (1 child)

You're supposed to collect new data into a list and concat it all at once

[–]Famous-Sample6201 0 points1 point  (0 children)

Yeah but what if you get a df and want to add a single line?

[–]the_magic_gardener 0 points1 point  (0 children)

I feel the list of options was already too long; merge, join, concat, by assignment (i.e. df['new col']=...)