Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CONCAT1 multiple dfs and add nan value
- dfs = [street, city, state, zipcode]
- nan_value = 'DROP'
- adds_merge = pd.concat(dfs, join='outer', axis=1).fillna(nan_value)
- #dropping the mass amount of duplicated columns created by concat above
- adds_merge = adds_merge.loc[:,~adds_merge.columns.duplicated()]
- #CONCAT2
- def concat_ordered_columns(frames):
- columns_ordered = []
- for frame in frames:
- columns_ordered.extend(x for x in frame.columns if x not in columns_ordered)
- log = pd.concat(frames)
- return log[columns_ordered]
- data = [search_merge,dl_merge]
- elpi_joins = concat_ordered_columns(data)
- #MERGE
- dl_merge = eventcat_dl.merge(elastic_dl, how='inner', left_on=['datetime','type','user'], right_on=['datetime','type','user'])
- #JOIN
- vajoin = visit_action.merge(visit_in, how='inner', left_on=['idvisitor', 'datetime','idvisit'], right_on=['idvisitor', 'datetime','idvisit'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement