title: Merge pandas dataframe with dataframe from csv
body: <p>I have a csv file where each row has a date yyyy-MM-dd and a count (e.g. 1, 2, 6).</p>
  
  <pre><code>2020-06-08,53
  202-06-09,12
  </code></pre>
  
  <p>I read this into a dataframe as such and index on the date:</p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  
  data_df = pd.read_csv('data.csv', header=0, names=['date', 'count'])
  data_df['dt'] = pd.to_datetime(data_df['date'])
  data_df = data_df.set_index('dt')
  data_df.drop(['date'], axis=1, inplace=True)
  </code></pre>
  
  <p>I then create a dataframe for a date range:</p>
  
  <pre class="lang-py prettyprint-override"><code>date_rng = pd.date_range(start='1/1/2020', end='12/31/2020', freq='D')
  df = pd.DataFrame(date_rng, columns=['date'])
  df['dt'] = pd.to_datetime(df['date'])
  df = df.set_index('dt')
  df.drop(['date'], axis=1, inplace=True)
  df['count'] = 0
  </code></pre>
  
  <p>Then I merged them:</p>
  
  <pre class="lang-py prettyprint-override"><code>df.update(data_df)
  </code></pre>
  
  <p>When I print <code>df</code> it looks correct - it contains the default data, and where present in the csv, contains the actual count from the corresponding csv row.</p>
  
  <p>I then use the calmap module (<a href="https://pythonhosted.org/calmap/" rel="nofollow noreferrer">https://pythonhosted.org/calmap/</a>) to generate a heatmap over the year:</p>
  
  <pre class="lang-py prettyprint-override"><code>calmap.yearplot(df, year=2020, cmap='YlGn', daylabels='SMTWTFS', fig_kws=dict(figsize=(8, 4)))
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>ValueError: Shape of passed values is (1, 4), indices imply (366, 4)
  </code></pre>
  
  <p>I am missing something obvious.  Most of the above code is lifted from somewhere.</p>
  
  <p>Any help is appreciated.  I am pretty new to pandas and I am working through some tutorials but so far nothing.</p>