diff options
| author | T-Aji <tolujbd2@gmail.com> | 2024-08-22 10:09:22 +0100 |
|---|---|---|
| committer | T-Aji <tolujbd2@gmail.com> | 2024-08-22 10:09:22 +0100 |
| commit | d04f2474b9b6d3bc11441a1cecfb3cd9e3d67f69 (patch) | |
| tree | 04cf2494f15e0f4bbb8b57705f133164d976abd0 /src/fact-sales-order.py | |
| parent | 956bc9223a584c9cb687277f9000967f9b3ddc6b (diff) | |
| parent | 5b2b4864eae129e112e70d093eb66498d7de401e (diff) | |
| download | de-project-bentley-d04f2474b9b6d3bc11441a1cecfb3cd9e3d67f69.tar.gz de-project-bentley-d04f2474b9b6d3bc11441a1cecfb3cd9e3d67f69.zip | |
wip: creating dim dataframes
Diffstat (limited to 'src/fact-sales-order.py')
| -rw-r--r-- | src/fact-sales-order.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/fact-sales-order.py b/src/fact-sales-order.py index ef18f02..870f660 100644 --- a/src/fact-sales-order.py +++ b/src/fact-sales-order.py @@ -1,7 +1,8 @@ import pandas as pd from src.transform_lambda import get_dataframes -dict_of_df = get_dataframes() # {"design": "design dataframe", "address": "address dataframe", ....} +# {"design": "design dataframe", "address": "address dataframe", ....} +dict_of_df = get_dataframes() # iterates through each dataframe in the list of dataframes and assigns them to a variable @@ -33,16 +34,30 @@ dim_currency["currency_name"] = dim_currency["currency_code"].map(mappings) # creates the dim_location dataframe -# need to change address id to location id +# need to change address id to location id "dim_location dataframe: (location_id, address_line_1, address_line_2, district, city, postal code, country, phone)" df_address.rename(columns={"address_id": "location_id"}) dim_location = df_address.loc[:, "location_id", "address_line_1", "address_line_2", "district", "city", "postal_code" "country", "phone"] # creates the dim_counterparty dataframe -counterparty_address = pd.merge(df_counterparty, df_address, left_on="legal_address_id", right_on='address_id', how="outer") -counterparty_address.rename(columns={"address_line_1": "counterparty_legal_address_line_1", "address_line_2": "counterparty_legal_address_line_2", - "district": "counterparty_legal_district", "city": "counterparty_legal_city", "postal_code": "counterparty_postal_code", - "country": "counterparty_legal_country", "phone": "counterparty_legal_phone_number"}) +counterparty_address = pd.merge( + df_counterparty, + df_address, + left_on="legal_address_id", + right_on="address_id", + how="outer" +) +counterparty_address.rename( + columns={ + "address_line_1": "counterparty_legal_address_line_1", + "address_line_2": "counterparty_legal_address_line_2", + "district": "counterparty_legal_district", + "city": "counterparty_legal_city", + "postal_code": "counterparty_postal_code", + "country": "counterparty_legal_country", + "phone": "counterparty_legal_phone_number", + } +) dim_counterparty = df_counterparty.loc[:, "counterparty_id", "counterparty_legal_name", "counterparty_legal_address_line_1", "counterparty_legal_address_line_2", "counterparty_legal_district", "counterpart_legal_city", @@ -68,4 +83,4 @@ dim_date = ["date_id", "year", "month", "day", "day_of_week", "day_name", "month # TO DO: -# fact_sales_order
\ No newline at end of file +# fact_sales_order |
