title: Pandas - Incrementally add to DataFrame
body: <p>I'm trying to add rows and columns to pandas incrementally. I have a lot of data stored across multiple datastores and a heuristic to determine a value. As I navigate across this datastore, I'd like to be able to incrementally update a dataframe, where in some cases, either names or days will be missing.</p>
  
  <pre><code>def foo():
      df = pd.DataFrame()
      year = 2016
      names = ['Bill', 'Bob', 'Ryan']
      for day in range(1, 4, 1):
          for name in names:
              if random.choice([True, False]):   # sometimes a name will be missing
                  continue
              value = random.randrange(0, 20, 1) # random value from heuristic
              col = '{}_{}'.format(year, day)    # column name
              df = df.append({col: value, 'name': name}, ignore_index=True)
      df.set_index('name', inplace=True, drop=True)
      print(df.loc['Bill'])
  </code></pre>
  
  <p>This produces the following results:</p>
  
  <pre><code>      2016_1  2016_2  2016_3
  name                        
  Bill    15.0     NaN     NaN
  Bill     NaN    12.0     NaN
  </code></pre>
  
  <p>I've created a heatmap of the data and it's blocky due to duplicate names, so the output I'm looking for is:</p>
  
  <pre><code>      2016_1  2016_2  2016_3
  name                        
  Bill    15.0    12.0     NaN
  </code></pre>
  
  <p>How can I combine these rows?</p>
  
  <p>Is there a more efficient means of creating this dataframe?</p>