def boss(df, bill_components, boss): # boss.loc[:, 'groove_boss'] = \ # boss['groove'].map(yes_no_null) # boss.loc[:, 'unique_feature_boss'] = \ # boss['unique_feature'].map(yes_no_null) # boss.loc[:, 'orientation_boss'] = \ # boss['orientation'].map(yes_no_null) boss = boss_impute(boss) #boss = boss_type(boss) #boss = outside_shape(boss) #boss = base_type(boss) #boss = boss[boss['weight'] <= 2.2] #boss = boss[boss['height_over_tube'] <= 50.9] boss = boss.drop(['groove', 'unique_feature', 'orientation', 'component_type_id', 'connection_type_id', 'base_diameter', 'base_type', 'type', 'shoulder_diameter', 'outside_shape'], axis=1) boss = utils.rename_comp_columns(boss, 'boss') boss_comps = boss_components(bill_components, boss) df = pd.merge(df, boss_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def adaptor(df, bill_components, adaptor): adaptor.loc[:, 'unique_feature_adaptor'] = \ adaptor['unique_feature'].map(yes_no_null) adaptor.loc[:, 'orientation_adaptor'] = \ adaptor['orientation'].map(yes_no_null) adaptor = adaptor_impute(adaptor) #adaptor = end_forms(adaptor) adaptor = adaptor.drop([ 'component_type_id', 'connection_type_id_1', 'connection_type_id_2', 'unique_feature', 'orientation', 'end_form_id_1', 'end_form_id_2', 'adaptor_angle' ], axis=1) adaptor = utils.rename_comp_columns(adaptor, 'adaptor') adaptor_comps = adaptor_components(bill_components, adaptor) df = pd.merge(df, adaptor_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def threaded(df, bill_components, threaded): # threaded.loc[:, 'unique_feature_threaded'] = threaded['unique_feature'] \ # .map(yes_no_null) threaded.loc[:, 'orientation_threaded'] = threaded['orientation'] \ .map(yes_no_null) threaded = threaded_impute(threaded) threaded = threaded.drop([ 'unique_feature', 'orientation', 'connection_type_id_1', 'connection_type_id_2', 'connection_type_id_3', 'connection_type_id_4', 'end_form_id_1', 'end_form_id_2', 'end_form_id_3', 'end_form_id_4', 'nominal_size_4' ], axis=1) threaded = utils.rename_comp_columns(threaded, 'threaded') thread_comps = threaded_components(bill_components, threaded) df = pd.merge(df, thread_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def tee(df, bill_components, tee): tee.loc[:, 'groove_tee'] = \ tee['groove'].map(yes_no_null) tee.loc[:, 'unique_feature_tee'] = \ tee['unique_feature'].map(yes_no_null) # tee.loc[:, 'orientation_tee'] = \ # tee['orientation'].map(yes_no_null) tee = class_code(tee) #tee = plug_class(tee) tee = tee.drop([ 'groove', 'unique_feature', 'orientation', 'component_type_id', 'mj_plug_class_code' ], axis=1) tee = utils.rename_comp_columns(tee, 'tee') tee_comps = tee_components(bill_components, tee) df = pd.merge(df, tee_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def boss(df, bill_components, boss): # boss.loc[:, 'groove_boss'] = \ # boss['groove'].map(yes_no_null) # boss.loc[:, 'unique_feature_boss'] = \ # boss['unique_feature'].map(yes_no_null) # boss.loc[:, 'orientation_boss'] = \ # boss['orientation'].map(yes_no_null) boss = boss_impute(boss) #boss = boss_type(boss) #boss = outside_shape(boss) #boss = base_type(boss) #boss = boss[boss['weight'] <= 2.2] #boss = boss[boss['height_over_tube'] <= 50.9] boss = boss.drop([ 'groove', 'unique_feature', 'orientation', 'component_type_id', 'connection_type_id', 'base_diameter', 'base_type', 'type', 'shoulder_diameter', 'outside_shape' ], axis=1) boss = utils.rename_comp_columns(boss, 'boss') boss_comps = boss_components(bill_components, boss) df = pd.merge(df, boss_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def float_(df, bill_components, float_): float_.loc[:, 'orientation_float'] = float_['orientation'] \ .map(yes_no_null) float_ = float_[float_['weight'] <= 2.5] float_ = float_.drop(['component_type_id', 'orientation'], axis=1) float_ = utils.rename_comp_columns(float_, 'float') float_comps = float_components(bill_components, float_) df = pd.merge(df, float_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def nut(df, bill_components, nut): # nut.loc[:, 'orientation_nut'] = nut['orientation'] \ # .map(yes_no_null) # nut.loc[:, 'blind_hole_nut'] = nut['blind_hole'] \ # .map(yes_no_null) nut = nut_impute(nut) nut = nut.drop(['component_type_id', 'orientation', 'blind_hole', 'seat_angle'], axis=1) nut = utils.rename_comp_columns(nut, 'nut') nut_comps = nut_components(bill_components, nut) df = pd.merge(df, nut_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def hfl(df, bill_components, hfl): hfl.loc[:, 'plating_hfl'] = hfl['plating'] \ .map(yes_no_null) hfl.loc[:, 'orientation_hfl'] = hfl['orientation'] \ .map(yes_no_null) hfl = corresponding_shell(hfl) hfl = coupling_class(hfl) hfl = material(hfl) hfl = hfl.drop(['plating', 'orientation'], axis=1) hfl = utils.rename_comp_columns(hfl, 'hfl') hfl_comps = hfl_components(bill_components, hfl) df = pd.merge(df, hfl_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def straight(df, bill_components, straight): # straight.loc[:, 'groove_straight'] = straight['groove'] \ # .map(yes_no_null) # straight.loc[:, 'unique_feature_straight'] = straight['unique_feature'] \ # .map(yes_no_null) straight.loc[:, 'orientation_straight'] = straight['orientation'] \ .map(yes_no_null) straight = straight_impute(straight) straight = straight.drop(['groove', 'unique_feature', 'orientation', 'component_type_id', 'mj_class_code'], axis=1) straight = utils.rename_comp_columns(straight, 'straight') straight_comps = straight_components(bill_components, straight) df = pd.merge(df, straight_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def sleeve(df, bill_components, sleeve): #sleeve.loc[:, 'unique_feature_sleeve'] = \ # sleeve['unique_feature'].map(yes_no_null) #sleeve.loc[:, 'plating_sleeve'] = \ # sleeve['plating'].map(yes_no_null) #sleeve.loc[:, 'orientation_sleeve'] = \ # sleeve['orientation'].map(yes_no_null) sleeve.loc[:, 'length'] = sleeve['length'] \ .apply(lambda x: 14.4 if x == 9999 else x) sleeve = sleeve.drop(['orientation', 'plating', 'unique_feature', 'intended_nut_thread', 'weight'], axis=1) sleeve = utils.rename_comp_columns(sleeve, 'sleeve') sleeve_comps = sleeve_components(bill_components, sleeve) df = pd.merge(df, sleeve_comps, left_on='tube_assembly_id', right_index=True, how='left') #df = clean_sleeve(df) return df
def elbow(df, bill_components, elbow): elbow.loc[:, 'groove_elbow'] = elbow['groove'].map(yes_no_null) #elbow.loc[:, 'unique_feature_elbow'] = elbow['unique_feature'].map(yes_no_null) #elbow.loc[:, 'orientation_elbow'] = elbow['orientation'].map(yes_no_null) elbow = elbow_impute(elbow) #elbow = class_code(elbow) #elbow = plug_class(elbow) elbow = elbow.drop(['groove', 'unique_feature', 'orientation', 'component_type_id', 'elbow_angle', 'overall_length', 'plug_diameter', 'mj_class_code', 'extension_length', 'mj_plug_class_code'], axis=1) elbow = utils.rename_comp_columns(elbow, 'elbow') elbow_comps = elbow_components(bill_components, elbow) df = pd.merge(df, elbow_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def tee(df, bill_components, tee): tee.loc[:, 'groove_tee'] = \ tee['groove'].map(yes_no_null) tee.loc[:, 'unique_feature_tee'] = \ tee['unique_feature'].map(yes_no_null) # tee.loc[:, 'orientation_tee'] = \ # tee['orientation'].map(yes_no_null) tee = class_code(tee) #tee = plug_class(tee) tee = tee.drop(['groove', 'unique_feature', 'orientation', 'component_type_id', 'mj_plug_class_code'], axis=1) tee = utils.rename_comp_columns(tee, 'tee') tee_comps = tee_components(bill_components, tee) df = pd.merge(df, tee_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def adaptor(df, bill_components, adaptor): adaptor.loc[:, 'unique_feature_adaptor'] = \ adaptor['unique_feature'].map(yes_no_null) adaptor.loc[:, 'orientation_adaptor'] = \ adaptor['orientation'].map(yes_no_null) adaptor = adaptor_impute(adaptor) #adaptor = end_forms(adaptor) adaptor = adaptor.drop(['component_type_id', 'connection_type_id_1', 'connection_type_id_2', 'unique_feature', 'orientation', 'end_form_id_1', 'end_form_id_2', 'adaptor_angle'], axis=1) adaptor = utils.rename_comp_columns(adaptor, 'adaptor') adaptor_comps = adaptor_components(bill_components, adaptor) df = pd.merge(df, adaptor_comps, left_on='tube_assembly_id', right_index=True, how='left') return df
def threaded(df, bill_components, threaded): # threaded.loc[:, 'unique_feature_threaded'] = threaded['unique_feature'] \ # .map(yes_no_null) threaded.loc[:, 'orientation_threaded'] = threaded['orientation'] \ .map(yes_no_null) threaded = threaded_impute(threaded) threaded = threaded.drop(['unique_feature', 'orientation', 'connection_type_id_1', 'connection_type_id_2', 'connection_type_id_3', 'connection_type_id_4', 'end_form_id_1', 'end_form_id_2', 'end_form_id_3', 'end_form_id_4', 'nominal_size_4'], axis=1) threaded = utils.rename_comp_columns(threaded, 'threaded') thread_comps = threaded_components(bill_components, threaded) df = pd.merge(df, thread_comps, left_on='tube_assembly_id', right_index=True, how='left') return df