code: def vwap(df):
      """
      Volume-weighted average price (VWAP) is a ratio generally used by
      institutional investors and mutual funds to make buys and sells so as not
      to disturb the market prices with large orders. It is the average share
      price of a stock weighted against its trading volume within a particular
      time frame, generally one day.
  
      Read more: Volume Weighted Average Price - VWAP
      https://www.investopedia.com/terms/v/vwap.asp#ixzz4xt922daE
  
      Parameters
      ----------
      df: pd.DataFrame
  
      Returns
      -------
  
      """
      if "close" not in df.columns or "volume" not in df.columns:
          raise ValueError(
              "price data must include `volume` and `close`"
          )
  
      vol_sum = np.nansum(df["volume"].values)
  
      try:
          ret = (
              np.nansum(df["close"].values * df["volume"].values)
              / vol_sum
          )
      except ZeroDivisionError:
          ret = np.nan
  
      return ret
  
imports: import copy
  import csv
  import json
  import numbers
  import os
  import time
  import numpy
  import pandas
  from catalyst.assets._assets import TradingPair
  from catalyst.exchange.utils.exchange_utils import get_algo_folder
  from catalyst.utils.paths import data_root, ensure_directory
  from operator import itemgetter
label_desc: Use image node_id 4 for calling a global function with example usage: vwap(df) and returns: ret