Exemple #1
0
 def process_order_data(self):
     self.jd_order_info['order_status'] = self.jd_order_info[
         'status'].apply(CheckDataForJD.check_order_status)
     self.jd_order_info['pay_channel'] = self.jd_order_info[
         'payType'].apply(CheckDataForJD.check_order_pay_type)
     self.jd_order_info['amount_f'] = self.jd_order_info['amount'].apply(
         CheckDataForJD.check_order_amount_type)
     self.jd_order_info['year_month'] = self.jd_order_info['time'].apply(
         CheckDataForJD.get_order_time_year_mouth)
     self.jd_order_info['year_month_day'] = \
         self.jd_order_info['time'].apply(CheckDataForJD.get_order_time_year_mouth_days)
     self.jd_order_info['month'] = self.jd_order_info['time'].apply(
         CheckDataForJD.get_order_time_mouth)
     self.jd_order_info['quarter_tags'] = self.jd_order_info['month'].apply(
         CheckDataForJD.map_mouth_to_quarter)
     self.jd_order_info['year_quarter'] = \
         self.jd_order_info.apply(lambda x: x['year_month'][0:5] + str(x['quarter_tags']), axis=1)
     _amount_check_list = [100, 200, 500, 1000, 3000, 5000, 10000]
     for _i in _amount_check_list:
         self.jd_order_info['if_order_amt_over_%s' % str(_i)] = \
             self.jd_order_info['amount_f'].apply(CheckDataForJD.check_order_amount_config(_i))
     self.jd_order_info['hour'] = self.jd_order_info['time'].apply(
         CheckDataForJD.get_order_time_hour)
     self.jd_order_info['order_trade_time'] = self.jd_order_info[
         'hour'].apply(CheckDataForJD.map_order_time)
     for _i in CATEGORY_TAGS:
         self.jd_order_info['if_order_buy_%s' % _i] = \
             self.jd_order_info['title'].apply(CheckDataForJD.check_order_goods_type_config(USE_FOR_CHECK_PERSONAL_CARE))
Exemple #2
0
    def process_order_data(self):
        if not self.jd_order_info.empty:
            self.jd_order_info['order_status'] = self.jd_order_info[
                'status'].apply(CheckDataForJD.check_order_status)
            self.jd_order_info['pay_channel'] = self.jd_order_info[
                'payType'].apply(CheckDataForJD.check_order_pay_type)
            self.jd_order_info['amount_f'] = self.jd_order_info[
                'amount'].apply(CheckDataForJD.check_order_amount_type)
            self.jd_order_info['year_month'] = self.jd_order_info[
                'time'].apply(CheckDataForJD.get_order_time_year_mouth)
            self.jd_order_info['year_month_day'] = \
                self.jd_order_info['time'].apply(CheckDataForJD.get_order_time_year_mouth_days)
            self.jd_order_info['month'] = self.jd_order_info['time'].apply(
                CheckDataForJD.get_order_time_mouth)
            self.jd_order_info['quarter_tags'] = self.jd_order_info[
                'month'].apply(CheckDataForJD.map_mouth_to_quarter)
            self.jd_order_info['year_quarter'] = \
                self.jd_order_info.apply(lambda x: x['year_month'][0:5] + str(x['quarter_tags']), axis=1)
            _amount_check_list = [100, 200, 500, 1000, 3000, 5000, 10000]
            for _i in _amount_check_list:
                self.jd_order_info['if_order_amt_over_%s' % str(_i)] = \
                    self.jd_order_info['amount_f'].apply(CheckDataForJD.check_order_amount_config(_i))
            self.jd_order_info['hour'] = self.jd_order_info['time'].apply(
                CheckDataForJD.get_order_time_hour)
            self.jd_order_info['order_trade_time'] = self.jd_order_info[
                'hour'].apply(CheckDataForJD.map_order_time)

            self.jd_order_info['if_order_use_jd_shop'] = \
                self.jd_order_info['title'].apply(CheckDataForJD.check_order_goods_type_config(USE_FOR_CHECK_JD_SHOP))
            self.jd_order_info['if_order_use_jd_send'] = \
                self.jd_order_info['title'].apply(CheckDataForJD.check_order_goods_type_config(USE_FOR_CHECK_JD_SEND))
            for _k, _v in CATEGORY_RESHAPE_DICT.items():
                self.jd_order_info['if_order_buy_%s' % _k] = \
                    self.jd_order_info['title'].apply(CheckDataForJD.check_order_goods_type_config(_v))
        else:
            return pd.DataFrame()