title: Convert wide pandas dataframe of daily data by week into long dataframe of daily data
body: <p>I am working with a pandas dataframe where each row includes the start date for the week, and the daily data for that week. For example:</p>
  
  <pre><code>    start_date  mon  tue  wed   thu   fri   sat  sun
      2017-01-01  10   15   8     19    20    21   4
  </code></pre>
  
  <p>I would like to do time series analysis and need the data in the following format:</p>
  
  <pre><code>    date         amount
      2017-01-01   10
      2017-01-02   15
      2017-01-03   8
      2017-01-04   19
      2017-01-05   20
      2017-01-06   21
      2017-01-07   4
  </code></pre>
  
  <p>I believe I can use pandas melt to convert the dataset from wide to long, but I am struggling with how to best fill in the dates.</p>
  
  <p>I have tried the following approach, but it seems like a work around:</p>
  
  <pre><code>df = pd.DataFrame({'start_date': {0: '2017-01-01'}, 'mon': {0: 10},
                     'tue': {0: 15}, 'wed': {0: 8}, 'thu': {0: '19'}, 
                     'fri': {0: 20}, 'sat': {0: 21}, 'sun': {0: 4}})
  
  df = df.melt(id_vars='start_date', value_name="amount")
  
  day_add = {'mon': 0,
             'tue': 1,
             'wed': 2,
             'thu': 3,
             'fri': 4,
             'sat': 5,
             'sun': 6,
             }
  
  df = df.replace({"variable": day_add})
  
  df['date'] = pd.to_datetime(df['start_date'], infer_datetime_format=True) + 
               pd.to_timedelta(df['variable'], unit='d')
  
  print(df[['date', 'amount']].sort_values(by=['date']))
  </code></pre>
  
  <p>Results from the current code:</p>
  
  <pre><code>        date amount
  1 2017-01-01     10
  5 2017-01-02     15
  6 2017-01-03      8
  4 2017-01-04     19
  0 2017-01-05     20
  2 2017-01-06     21
  3 2017-01-07      4
  </code></pre>
  
  <p>Alternative approaches are welcome.</p>