Create new column based on groupby from other table

Hi there,

First I'm an absolute beginner, I've a training and test datasets they contain the following fields

Training

Product_ID, Customer_ID, Purchase_price

Test

Product_ID, Customer_ID

I want to calculate the mean Purchase_price per product and per customer and add them to the Test dataset.

can anybody help me to accomplish this

thanks in advance

Hi Yasser,

this can be easily done in 2 steps:

1) Use a GroupBy node on your Training data set, grouping by Product_ID and aggregating Purchase_price with a Mean function. This will generate a table with the mean purchase price for each unique product, identified by Product_ID.

2) Use a Joiner node (Inner join) to add the mean Purchase_price for each product, from the previous step, to you Test data set. You need to match the two tables by Product_ID.

Try if you can come up with a proper solution, otherwise feel free to post here again for additional help.

Cheers,
Marco.