title: Adding missing days of week and time of day in the pandas dataframe
body: <p>I have a pandas dataframe that looks like this:<a href="https://i.stack.imgur.com/hSGSk.jpg" rel="nofollow noreferrer">Dataframe</a></p>
  
  <p>Time of Day has levels: Early Morning, Morning, Afternoon, Evening, Late Night</p>
  
  <p>The objective is to make the data uniform by adding missing days of week and time of day between two observations. For instance, if the present row is <code>Wednesday, Early Morning</code> and the next row is <code>Thursday, Morning</code>, I want to add:</p>
  
  <pre><code>Wednesday Morning
  Wednesday Afternoon
  Wednesday Evening
  Wednesday late night
  Thursday Early Morning
  </code></pre>
  
  <p>as rows in between.  What I have tried so far is to convert the weeks and day levels into numbers and then subtracting them to come up with how many days or times to add in between. <a href="https://i.stack.imgur.com/ENU0Q.jpg" rel="nofollow noreferrer">DataFrame2</a></p>
  
  <p>I am wondering if there is a more efficient way to undertake this exercise. Here is the code I have written:  </p>
  
  <pre><code>for i1, col1 in dfMod.iterrows():
      if col1['day'] == "MONDAY":
          dfMod.ix[i1,'weekIndex'] = 1
      elif col1['day'] == "TUESDAY":
          dfMod.ix[i1,'weekIndex'] = 2
      elif col1['day'] == "WEDNESDAY":
          dfMod.ix[i1,'weekIndex'] = 3
      elif col1['day'] == "THURSDAY":
          dfMod.ix[i1,'weekIndex'] = 4
      elif col1['day'] == "FRIDAY":
          dfMod.ix[i1,'weekIndex'] = 5
      elif col1['day'] == "SATURDAY":
          dfMod.ix[i1,'weekIndex'] = 6
      else:
          dfMod.ix[i1,'weekIndex'] = 7
  
      if col1['timeType'] == "EARLY MORNING":
          dfMod.ix[i1,'dayIndex'] = 1
      elif col1['timeType'] == "MORNING":
          dfMod.ix[i1,'dayIndex'] = 2
      elif col1['timeType'] == "AFTERNOON":
          dfMod.ix[i1,'dayIndex'] = 3
      elif col1['timeType'] == "EVENING":
          dfMod.ix[i1,'dayIndex'] = 4
      else:
          dfMod.ix[i1,'dayIndex'] = 5
  dfMod = dfMod.reset_index(drop= True)
  dfMod.leadWeek = dfMod.groupby('adId')['weekIndex'].shift(-1)
  dfMod.leadDay = dfMod.groupby('adId')['dayIndex'].shift(-1)
  dfMod['diffWeek'] = dfMod['leadWeek'] - dfMod['weekIndex']
  dfMod['diffDay'] = dfMod['leadDay'] - dfMod['dayIndex']
  dfMod.head()
  </code></pre>