title: Create a vector of dates in python pandas
body: <p>I have three columns in my data:</p>
  <pre><code>mall_id product_id sold_date
   13       10001     04-01-2020
   13       10002     05-06-2020
   14       10001     03-01-2020
   13       10001     05-02-2020
  </code></pre>
  <p>I want to create a vector from sold_date for each of the mall_id, product_id unique combination.
  Vector should be such that length of the vector should be max(sold_date) - min(sold_date) and it should be in the form of 1s and 0s (E.g. [0,1,0,0,0,1,1,1]) such that each digit represents whether a purchase was made or not that day for the mall_id product_id combo. (i.e. 0 means no purchase for that day and 1 means a purchase was made].</p>
  <p>After creating the vectors, I want to transform it as a new column in pandas with following numpy functions:</p>
  <pre><code>times_1 = np.diff(np.where(vector))
  np.std(times_1)/np.mean(times_1)
  </code></pre>
  <p>I am able to apply the numpy functions for a single vector but unable to create the vectors in my dataframe and then apply them for every value in the column. I tried several ways to do it but couldn't figure it out as I am new to pandas.</p>
  <p>Can someone provide some direction? I would be really grateful.</p>