0

Sorry, I am new to Python. I am looking for some general guidance. Here is my problem.

I have a process that produces observations on five variables. For each iteration through the process, I would like the five variables to be added to a dataframe. That is, each row of the dataframe is a set of related observations on the five variables. If I iterate through the process 1,000 times, I will have 1,000 observations on each of the five variables.

I know how to initialize the the empty dataframe, but how do I go about adding new rows of data? This seems like it should be easy, but I am just not sure.

Thanks,

  • 1
    Why don't you post the code that you have thus far – rohrl77 Mar 07 '17 at 13:18
  • Just to elaborate on the answers in the duplicate: `df.loc[len(df)] = data` where `data` is a tuple or list of "records" is usually the most efficient way to add rows to a dataframe. – DeepSpace Mar 07 '17 at 13:20

0 Answers0