return shenzhen margin data

    Arguments:
        date {str YYYY-MM-DD} -- date format

    Returns:
        pandas.DataFrame -- res for margin data
508256
def QA_fetch_get_sz_margin(date):
    

    if date in trade_date_sse:
        return pd.read_excel(_sz_url.format(date)).assign(date=date).assign(sse='sz')
313698
def date_string_to_date(p_date):
    
    result = None

    if p_date:
        parsed_date = re.match(r'(\d{4})-(\d{2})-(\d{2})', p_date)
        if parsed_date:
            result = date(
                int(parsed_date.group(1)),  # year
                int(parsed_date.group(2)),  # month
                int(parsed_date.group(3))   # day
            )
        else:
            raise ValueError

    return result
1314237
def formatdt(date: datetime.date, include_time: bool = True) -> str:
    
    if include_time:
        return date.strftime("%Y-%m-%dT%H:%M")
    else:
        return date.strftime("%Y-%m-%d")
134669
def get_date(self):
        
        if self.safe_type == EsaSafeType.OLD_TYPE:
            name = self.product_id.split('_')[-2]
            date = [name[1:5], name[5:7], name[7:9]]
        else:
            name = self.product_id.split('_')[2]
            date = [name[:4], name[4:6], name[6:8]]
        return '-'.join(date_part.lstrip('0') for date_part in date)
870747
def format_date(self, value, format_):
        
        date_ = make_date(value)
        return dates.format_date(date_, format_, locale=self.lang)
1150611
def _get_date(data, position, dummy, opts):
    """"""
    end = position + 8
    millis = _UNPACK_LONG(data[position:end])[0]
    diff = ((millis % 1000) + 1000) % 1000
    seconds = (millis - diff) / 1000
    micros = diff * 1000
    if opts.tz_aware:
        return EPOCH_AWARE + datetime.timedelta(
            seconds=seconds, microseconds=micros), end
    else:
        return EPOCH_NAIVE + datetime.timedelta(
            seconds=seconds, microseconds=micros), end
136443
def date(page):
    
    soup = BeautifulSoup(page)
    try:
        page_date = soup.find('input', attrs={'name': 'date'})['value']
        parsed_date = datetime.strptime(page_date, '%Y-%m-%d')
        return parsed_date.strftime('%a, %b %d, %Y')
    except:
        return None
1234589
def getDateFromToday(delta,strfmt='%Y%m%d'):
	
	return (dt.date.today() + dt.timedelta(delta)).strftime(strfmt)
1070719
def date_for_str(date_str):
    ''''''
    try:
        for date_format in itertools.permutations(['%Y','%m','%d']):
            try:
                date = datetime.strptime(date_str,''.join(date_format))
                raise StopIteration
            except ValueError:
                pass
        return None
    except StopIteration:
        return date
639297
def make_date(df:DataFrame, date_field:str):
    ""
    field_dtype = df[date_field].dtype
    if isinstance(field_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype):
        field_dtype = np.datetime64
    if not np.issubdtype(field_dtype, np.datetime64):
        df[date_field] = pd.to_datetime(df[date_field], infer_datetime_format=True)
1249679
def dateRect( self, date ):
        
        data = self._dateGrid.get(date.toJulianDay())
        if ( data ):
            return QRectF(data[1])
        return QRectF()
1066585
def from_str(date):
        
        month = date[:3][0] + date[:3][-2:].lower()
        if month not in NAMED_MONTHS:
            raise CanNotFormatError('Month not recognized')

        date = date.replace(',', '').replace(' ', '').replace('.', '')
        try:
            day_unit = [x for x in ['st', 'rd', 'nd', 'th'] if x in date][0]
            day = int(re.search(r'\d+', date.split(day_unit)[0]).group())
            year = int(re.search(r'\d+', date.split(day_unit)[1]).group())
            numeric_month = NAMED_MONTHS[month]
            return datetime.date(int(year), numeric_month, day)
        except:
            raise CanNotFormatError('Not well formatted. Expecting something like May,21st.2015')
722405
def S(self):
    "'"
    if self.data.day in (11, 12, 13): # Special case
      return u'th'
    last = self.data.day % 10
    if last == 1:
      return u'st'
    if last == 2:
      return u'nd'
    if last == 3:
      return u'rd'
    return u'th'
132821
def strptime(cls, data, format, scale=DEFAULT_SCALE):  # pragma: no cover
        
        return cls(datetime.strptime(data, format), scale=scale)
1071058
function fullCompareDate(date, d, margin) {
  var tmp;
  if (!dateIsValid(date)) return;
  if (isString(d)) {
    d = trim(d).toLowerCase();
    switch(true) {
      case d === 'future':    return date.getTime() > getNewDate().getTime();
      case d === 'past':      return date.getTime() < getNewDate().getTime();
      case d === 'today':     return compareDay(date);
      case d === 'tomorrow':  return compareDay(date,  1);
      case d === 'yesterday': return compareDay(date, -1);
      case d === 'weekday':   return getWeekday(date) > 0 && getWeekday(date) < 6;
      case d === 'weekend':   return getWeekday(date) === 0 || getWeekday(date) === 6;

      case (isDefined(tmp = English.weekdayMap[d])):
        return getWeekday(date) === tmp;
      case (isDefined(tmp = English.monthMap[d])):
        return getMonth(date) === tmp;
    }
  }
  return compareDate(date, d, margin);
}
70079
def fetch(self):
        
        self._validate_params()
        if self.islast:
            data = super(DailySummaryReader, self).fetch()
        else:
            data = self._fetch_dates()
        if self.output_format == 'pandas':
            data.set_index('date', inplace=True)
            return data
        else:
            return data
19136
def _get_data(self):
        
        # Split the list of times into begin and end dates. If only
        # one date is supplied, set both begin and end dates equal to that date.

        body, header, dates_long, dates = self._get_data_raw()

        params = self._get_fwf_params()

        df_body = pd.read_fwf(StringIO(body), **params['body'])
        df_header = pd.read_fwf(StringIO(header), **params['header'])
        df_body['date'] = dates_long

        df_body = self._clean_body_df(df_body)
        df_header = self._clean_header_df(df_header)
        df_header['date'] = dates

        return df_body, df_header