0

I'd like to use a DataFrame to manage data from many trials of an experiment I'm controlling with Python code. Ideally I will have one master dataframe with a row for each trial that lives in the main function namespace, and then a separate dict (or dataframe) returned from the function that I call to execute the important bits of code for each trial.

What is the best way to do a running update of the master dataframe with this returned set of data? So far I've come up with:

df = df.append(df_trial, ignore_index=True)

or

df = pd.concat([df, df_trial])

But neither seem ideal (and both take a relatively long time according to %timeit). Is there a more Pandonic way?

1 Answer 1

1

You should build a list of the pieces and concatenate them all in one shot at the end.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.