支持MultiIndex的cond和DateTimeIndex的cond
    条件成立  yes= True 或者 yes=1 根据不同的指标自己定

    Arguments:
        cond {[type]} -- [description]
192420
def BARLAST(cond, yes=True):
    
    if isinstance(cond.index, pd.MultiIndex):
        return len(cond)-cond.index.levels[0].tolist().index(cond[cond != yes].index[-1][0])-1
    elif isinstance(cond.index, pd.DatetimeIndex):
        return len(cond)-cond.index.tolist().index(cond[cond != yes].index[-1])-1
330730
def getIndexedValue(self, index):
        
        actions = self._actions

        if (type (actions) is list):
            dict = actions[index]
        else:
            dict = actions
        return dict.get('value', 'NoValue')
1133545
def execute_condition(cond):
    

    condition_method = 'rulengine.conditions.c_{0}_{1}'.format(
        cond.data_type, cond.operator)
    try:
        func = import_class(condition_method)
    except AttributeError:
        condition_method = 'rulengine.conditions.c_{0}'.format(
            cond.data_type)
        func = import_class(condition_method)

    executable_cond = convert_condition_to_executable(cond)
    return func(executable_cond)
266153
function hasIndexChanged(index, prevIndex) {
  if (typeof index !== 'string' || !index) return false;
  if (typeof prevIndex !== 'string' || !prevIndex) return true;
  return index !== prevIndex;
}
323580
private String concatDate(int rowIndex){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for concat date expression");
        }

        final DateTimeFormat yearFormat = DateTimeFormat.getFormat(DataType.DATE_FORMAT_YEAR_ONLY);
        final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
        final String rawDateFrom = currentRecord.getValueByFieldName(params[0]);
        Date dateFrom = DataType.ParseUtil.tryParseDate(rawDateFrom, DataType.DEFAULT_DATE);
        final String rawDateTo = currentRecord.getValueByFieldName(params[1]);
        Date dateTo = DataType.ParseUtil.tryParseDate(rawDateTo, DataType.DEFAULT_DATE);


        String res;
        if(dateFrom.equals(dateTo)){
            res = yearFormat.format(dateFrom);
        }else{
            res = yearFormat.format(dateFrom) + " - " + yearFormat.format(dateTo);
        }
        return res;
    }
979883
public function getcardbizuininfo($begin_date, $end_date, $cond_source = 0)
    {
        if (empty($begin_date) || empty($end_date) || !is_numeric($cond_source) || $cond_source < 0 || $cond_source > 1) {
            $this->setError('参数错误');

            return false;
        }

        if (is_numeric($begin_date)) {
            $begin_date = date('Y-m-d', $begin_date);
        }

        if (is_numeric($end_date)) {
            $end_date = date('Y-m-d', $end_date);
        }

        $queryStr                = [];
        $queryStr['begin_date']  = $begin_date;
        $queryStr['end_date']    = $end_date;
        $queryStr['cond_source'] = intval($cond_source);

        $this->apitype = 'datacube';
        $this->module  = 'getcardbizuininfo';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
1325440
function getCondition() {
  const type = NodeType.ConditionType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  let content = [];

  content.push(getIdent());

  while (pos < tokensLength) {
    const childType = tokens[pos].condition_child;

    if (childType === 0) break;
    else if (childType === 1) content.push(getFunction());
    else if (childType === 2) content.push(getBrackets());
    else if (childType === 3) content.push(getParentheses());
    else if (childType === 4) content.push(getVariable());
    else if (childType === 5) content.push(getIdent());
    else if (childType === 6) content.push(getNumber());
    else if (childType === 7) content.push(getDelim());
    else if (childType === 8) content.push(getOperator());
    else if (childType === 9) content.push(getCombinator());
    else if (childType === 10) content = content.concat(getSC());
    else if (childType === 11) content.push(getString());
  }

  return newNode(type, content, line, column);
}
572303
def _new_DatetimeIndex(cls, d):
    

    if "data" in d and not isinstance(d["data"], DatetimeIndex):
        # Avoid need to verify integrity by calling simple_new directly
        data = d.pop("data")
        result = cls._simple_new(data, **d)
    else:
        with warnings.catch_warnings():
            # we ignore warnings from passing verify_integrity=False
            # TODO: If we knew what was going in to **d, we might be able to
            #  go through _simple_new instead
            warnings.simplefilter("ignore")
            result = cls.__new__(cls, verify_integrity=False, **d)

    return result
1336950
def get_current(self, item=None, raw=False, start=None, end=None):
        
        item_indexer = slice(None)
        if item:
            item_indexer = self.items.get_loc(item)

        start_index = self._start_index
        end_index = self._pos

        # get inital date window
        where = slice(start_index, end_index)
        current_dates = self.date_buf[where]

        def convert_datelike_to_long(dt):
            if isinstance(dt, pd.Timestamp):
                return dt.asm8
            if isinstance(dt, datetime.datetime):
                return np.datetime64(dt)
            return dt

        # constrict further by date
        if start:
            start = convert_datelike_to_long(start)
            start_index += current_dates.searchsorted(start)

        if end:
            end = convert_datelike_to_long(end)
            _end = current_dates.searchsorted(end, 'right')
            end_index -= len(current_dates) - _end

        where = slice(start_index, end_index)

        values = self.buffer.values[item_indexer, where, :]
        current_dates = self.date_buf[where]

        if raw:
            # return copy so we can change it without side effects here
            return values.copy()

        major_axis = pd.DatetimeIndex(deepcopy(current_dates), tz='utc')
        if values.ndim == 3:
            return pd.Panel(values, self.items, major_axis, self.minor_axis,
                            dtype=self.dtype)

        elif values.ndim == 2:
            return pd.DataFrame(values, major_axis, self.minor_axis,
                                dtype=self.dtype)
617085
def conditions
      return ['1=0'] if !valid?

      conds       = []
      values      = []
      for col in klass.columns do
        col_str = col_name(col)
        val     = @attrs[encode_name(col)]
        if !val.blank?
          case col.type
          when :string, :text
            if val =~ /\*$/
              conds   << col_str + ' like ?'
              values  << val.gsub(/\*$/, '%')
            else
              conds   << col_str + '=?'
              values  << val
            end
          when :datetime
            case is_dbms?
            when Dbms::MYSQL
#             conds   << col_str + @_operator.exp(encode_name(col))
              conds   << sprintf("date(%s)",
                  col_str) +
                  @_operator.exp(encode_name(col))
            else
              conds   << sprintf("date(timezone('%s',%s))",
                  DEFAULT_TIMEZONE_FOR_TIMESTAMP_DATE_COMPARISON,
                  col_str) +
                  @_operator.exp(encode_name(col))
            end
            values  << val.to_s
          when :boolean
            case is_dbms?
            when Dbms::MYSQL
              conds   << col_str + @_operator.exp(encode_name(col))
              values  << (val=='true')
            else
              conds   << col_str + @_operator.exp(encode_name(col))
              values  << val
            end
          else
            conds   << col_str + @_operator.exp(encode_name(col))
            values  << val
          end
        end
      end
      return [conds.join(' and ')] + values
    end
369848
public boolean indexAppliesTo( JoinCondition condition ) {
        if (condition instanceof ChildNodeJoinCondition) {
            return indexAppliesTo((ChildNodeJoinCondition)condition);
        }
        if (condition instanceof DescendantNodeJoinCondition) {
            return indexAppliesTo((DescendantNodeJoinCondition)condition);
        }
        if (condition instanceof EquiJoinCondition) {
            return indexAppliesTo((EquiJoinCondition)condition);
        }
        if (condition instanceof SameNodeJoinCondition) {
            return indexAppliesTo((SameNodeJoinCondition)condition);
        }
        return false;
    }
1052076
def _GetDateValuesWithEpoch(self, number_of_days, date_time_epoch):
    
    return self._GetDateValues(
        number_of_days, date_time_epoch.year, date_time_epoch.month,
        date_time_epoch.day_of_month)
1134982
function collationIndex(x) {
  var id = ['boolean', 'number', 'string', 'object'];
  var idx = id.indexOf(typeof x);
  //false if -1 otherwise true, but fast!!!!1
  if (~idx) {
    if (x === null) {
      return 1;
    }
    if (Array.isArray(x)) {
      return 5;
    }
    return idx < 3 ? (idx + 2) : (idx + 3);
  }
  if (Array.isArray(x)) {
    return 5;
  }
}
110524
function checkFieldInIndex(index, field) {
  var indexFields = index.def.fields.map(getKey);
  for (var i = 0, len = indexFields.length; i < len; i++) {
    var indexField = indexFields[i];
    if (field === indexField) {
      return true;
    }
  }
  return false;
}
1140653
function getCondition() {
  const type = NodeType.ConditionType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  let content = [];
  let s;
  let _pos;

  content.push(getAtkeyword());

  while (pos < tokensLength) {
    if (checkBlock(pos)) break;

    s = checkSC(pos);
    _pos = pos + s;

    if (!_checkCondition(_pos)) break;

    if (s) content = content.concat(getSC());
    content.push(_getCondition());
  }

  return newNode(type, content, line, column);
}
939156
def caldata(self, time):
        ''' 
        '''
        if time.date() in self.__ocdate['close']:  # 判對是否為法定休市
            return False
        elif time.date() in self.__ocdate['open']:  # 判對是否為法定開市
            return True
        else:
            if time.weekday() <= 4:  # 判斷是否為平常日開市
                return True
            else:
                return False
1068963
void addIndexCondition(Expression[] exprList, Index index, int colCount,
                           boolean isJoin) {
// VoltDB extension
        if (rangeIndex == index && isJoinIndex && (!isJoin) &&
                (multiColumnCount > 0) && (colCount == 0)) {
            // This is one particular set of conditions which broke the classification of
            // ON and WHERE clauses.
            return;
        }
// End of VoltDB extension
        rangeIndex  = index;
        isJoinIndex = isJoin;

        for (int i = 0; i < colCount; i++) {
            Expression e = exprList[i];

            indexEndCondition =
                ExpressionLogical.andExpressions(indexEndCondition, e);
        }

        if (colCount == 1) {
            indexCondition = exprList[0];
        } else {
            findFirstExpressions = exprList;
            isMultiFindFirst     = true;
            multiColumnCount     = colCount;
        }
    }