code: def make_transaction_frame(transactions):
      
  
      transaction_list = []
      for dt in transactions.index:
          txns = transactions.loc[dt]
          if len(txns) == 0:
              continue
  
          for txn in txns:
              txn = map_transaction(txn)
              transaction_list.append(txn)
      df = pd.DataFrame(sorted(transaction_list, key=lambda x: x['dt']))
      df['txn_dollars'] = -df['amount'] * df['price']
  
      df.index = list(map(pd.Timestamp, df.dt.values))
      return df
docs: Formats a transaction DataFrame.
  
      Parameters
      ----------
      transactions : pd.DataFrame
          Contains improperly formatted transactional data.
  
      Returns
      -------
      df : pd.DataFrame
          Daily transaction volume and dollar ammount.
           - See full explanation in tears.create_full_tear_sheet.