File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -70,13 +70,15 @@ def __clean_csv_headers(header):
70
70
}
71
71
72
72
73
- def volgistics_address (index , street ):
73
+ def volgistics_address (street , index ):
74
74
result = ""
75
75
76
- for item in street :
77
- if isinstance (item , str ):
78
- if " " in item :
79
- result = item .split ()[index ]
76
+ if isinstance (street , str ):
77
+ if " " in street :
78
+ if index == 1 :
79
+ result = " " .join (street .split ()[1 :])
80
+ else :
81
+ result = street .split ()[index ]
80
82
81
83
return result
82
84
@@ -142,8 +144,8 @@ def normalize_phone_number(number):
142
144
"last_name" : "last_name" ,
143
145
"email" : "email" ,
144
146
"mobile" : lambda df : df ["cell" ].combine_first (df ["home" ]).apply (normalize_phone_number ),
145
- "street_and_number" : lambda df : volgistics_address ( 1 , df ["street_1" ]),
146
- "apartment" : lambda df : volgistics_address ( 0 , df ["street_1" ]),
147
+ "street_and_number" : lambda df : df ["street_1" ]. apply ( volgistics_address , index = 1 ),
148
+ "apartment" : lambda df : df ["street_1" ]. apply ( volgistics_address , index = 0 ),
147
149
"city" : "city" ,
148
150
"state" : "state" ,
149
151
"zip" : "zip" ,
You can’t perform that action at this time.
0 commit comments