title: How do I divide a column by its value at a particular date, when the dataframe is in a long format?
body: <p>My dataframe has 2 indices, date and country. Let's call the data column 'd'.</p>
  <p>What I want to do is to divide the data in 'd' by the value of 'd' at some fixed date t. Basically I want to rescale the series such that its value is 1 at date t.</p>
  <p>I tried groupby:</p>
  <pre><code>df['d2'] = df['d']/df.groupby(level='country')['d'].loc['t']
  </code></pre>
  <p>which fails of course because groupby doesn't have attribute .loc. What should I do here?</p>
  <p>Edit: example of my dataframe</p>
  <pre><code>date        country
  2020-04-01  US          93.872715
  2020-07-01  US         100.957790
  2020-10-01  US         102.083749
  2021-01-01  US         103.649602
  2021-04-01  US         105.350228
     
  2020-07-01  IL         101.168879
  2020-10-01  IL         103.576224
  2021-01-01  IL         103.212359
  2021-04-01  IL         107.240892
  2021-07-01  IL                NaN
  </code></pre>
  <p>I want to scale the data by the value at date '2020-07-01', so that the US data should be 93.87/100.96, 1, 102.08/100.96... and for IL, 101.17/103.58, 1, 103.21/103.58 ... and so on. I hope that makes sense.</p>