title: Separating multiple time series from a single column to separate columns for each series?
body: <p>I'm working with Python 3 on Mac OS 10.11.06 (el capitan).</p>
  <p>I have a .csv dataset consisting of about 3,700 time series sets (of unequal lengths).  The data are currently formatted as follows:</p>
  <p><strong>Current Format</strong></p>
  <pre><code>    trade_date  price_usd   ticker
  0   2016-01-01  434.33000   BTC
  1   2016-01-02  433.44000   BTC
  2   2016-01-03  430.01000   BTC
  3   2016-01-04  433.09000   BTC
  4   2016-01-05  431.96000   BTC
  ... ... ... ...
  2347227 2020-10-19  74.13000    BRAIN
  2347228 2020-10-20  71.97000    BRAIN
  2347229 2020-10-21  76.64000    BRAIN
  2347230 2020-10-22  80.90000    BRAIN
  2347231 2020-10-19  0.15004     DAOFI
  </code></pre>
  <p>Ignoring the default numerical index for the moment, notice that the datetime column, <code>trade_date</code>, is such that the sequence of values repeats with each new ticker group.  My goal is to transform the data such that each ticker name becomes a column header under which its corresponding daily prices are listed in correct order with the datetime value on which it was recorded (i.e. the datetime index does not repeat and the daily price values for the ticker symbols are the rows):</p>
  <p><strong>Target Format</strong></p>
  <pre><code>trade_date   ticker1   ticker2   ...   tickerN
  day1         t1p1      t2p1      ...   tNp1
  day2         t1p2      t2p2      ...   etc...
  .
  .
  .
  dayK
  </code></pre>
  <p>Thus far I've tried various approaches, including experiments with various methods, e.g. stack()/unstack(), groupby(), etc., as well as custom functions that attempt to iterate through the values to assign them to a new DF in which I created a structured frame into which to drop the values, but to no avail (see failed attempt below).</p>
  <p>New, empty target data frame with ticker symbol as col and trade_date range as index:</p>
  <pre><code>            BTC ETH XRP MKR LTC USDT BCH XLM EOS BNB ... MTLX INDEX WOA HAUT THRM YFED NMT DOKI BRAIN DAOFI
  2016-01-01  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  2016-01-02  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  2016-01-03  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  2016-01-04  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  2016-01-05  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  </code></pre>
  <p>Failed attempt to populate the above ...</p>
  <pre><code>for element in crypto_df['ticker']:
      if element == new_df.column and crypto['trade_date'] == new_df.index:
          df['ticker'] = element
  
  new_df.head()
  </code></pre>
  <p>My ultimate goal is to produce a multi-series time series forecast using FBProphet because of its ability to handle multiple time series forecasts in a &quot;single&quot; model.</p>
  <p>One last thought I've just had is that one could maybe create separate data frames for each ticker, then rejoin along the datetime index, creating the separate columns in the new DF along the way, but that seems a bit round-about (I've literally just done this for a couple thousand .csv files with equities data, for example)...  But I'd still like to find a more direct solution, if there is one?  Surely this scenario will arise again in the future!</p>
  <p>Thanks for any thoughts ...</p>