original_docstring: 
      gets the moving average to the data frame
      :param data: the dataframe
      :param int period: the window of rolling average
      :param str ma_type: type of moving average, either simple, 'sma' or exponensial, 'ema'
      :param str field: the field on which we perform the moving average
      :return: a dataframe with the moving average
      
docstring: gets the moving average to the data frame
docstring_tokens: gets the moving average to the data frame
code: def moving_average(data, period, ma_type=None, field=None):
      """
      gets the moving average to the data frame
      :param data: the dataframe
      :param int period: the window of rolling average
      :param str ma_type: type of moving average, either simple, 'sma' or exponensial, 'ema'
      :param str field: the field on which we perform the moving average
      :return: a dataframe with the moving average
      """
      ma_type = ma_type or 'sma'
      #     freq = (data.index[1] - data.index[0]).seconds
      if field:
          data = data[field]
      if ma_type.lower() == 'sma':
          profile = data.rolling(period, min_periods=0).mean()
      elif ma_type.lower() == 'ema':
          profile = data.ewm(span=period).mean()
      else:
          raise ValueError('{0} is not a known moving average type!'.format(ma_type))
      return profile
code_tokens: def moving_average ( data , period , ma_type = None , field = None ) : ma_type = ma_type or 'sma' if field : data = data [ field ] if ma_type . lower ( ) == 'sma' : profile = data . rolling ( period , min_periods = 0 ) . mean ( ) elif ma_type . lower ( ) == 'ema' : profile = data . ewm ( span = period ) . mean ( ) else : raise ValueError ( '{0} is not a known moving average type!' . format ( ma_type ) ) return profile
short_docstring: gets the moving average to the data frame
short_docstring_tokens: gets the moving average to the data frame
comment: """
      gets the moving average to the data frame
      :param data: the dataframe
      :param int period: the window of rolling average
      :param str ma_type: type of moving average, either simple, 'sma' or exponensial, 'ema'
      :param str field: the field on which we perform the moving average
      :return: a dataframe with the moving average
      """$SEP$#     freq = (data.index[1] - data.index[0]).seconds