Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Building features by data transformations

Hemanth22
6 - Meteoroid

We have executed a certain code in Python, which has to be replicated in alteryx. 

The sample data set is given below.

Order Date       Sales                 Sales_diff

 
2020-02-011.586325e+05-3.644159e+05
2020-03-012.110517e+061.951884e+06
2020-04-011.050913e+06-1.059604e+06
2020-05-019.446381e+05-1.062749e+05
2020-06-011.256447e+063.118092e+05
2020-07-011.222682e+06-3.376500e+04
2020-08-011.018037e+06-2.046455e+05
2020-09-013.075804e+062.057767e+06
2020-10-011.133098e+06-1.942706e+06
2020-11-012.816970e+061.683872e+0

 

For the same data we are working to transform it into the 2nd picture using shift() function in python to look like this.

 

sales_diff month_1 month_2 month_3 month_4 month_5 month_6 month_7 month_8 month_9 month_10 month_11 month_12

-3.644159e+05NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
1.951884e+06-3.644159e+05NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaNNaNNaNNaNNaNNaN
3.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaNNaNNaNNaNNaN
-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaNNaNNaNNaN
-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaNNaNNaN
2.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaNNaN
-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaNNaN
1.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaNNaN
-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaNNaN
-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05NaN
-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05
1.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06
-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+06
-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05
-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05
1.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+04

 

Later the transformed dataset should fill in the null values by resetting the index. 

 

sales_diff month_1 month_2 month_3 month_4 month_5 month_6 month_7 month_8 month_9 month_10 month_11 month_12

-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06-3.644159e+05
1.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+061.951884e+06
-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05-1.059604e+06
-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05-1.062749e+05
-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+043.118092e+05
1.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05-3.376500e+04
2.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06-2.046455e+05
1.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+062.057767e+06
-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06-1.942706e+06
1.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+051.683872e+06
6.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06-2.330960e+05
-2.085165e+066.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05-1.907109e+06
1.784283e+05-2.085165e+066.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06-2.553179e+05
1.089268e+061.784283e+05-2.085165e+066.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+051.040504e+06
-4.637695e+051.089268e+061.784283e+05-2.085165e+066.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05-2.248020e+05
6.036663e+05-4.637695e+051.089268e+061.784283e+05-2.085165e+066.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05-1.216302e+05
-5.874450e+056.036663e+05-4.637695e+051.089268e+061.784283e+05-2.085165e+066.890615e+021.614015e+06-1.208278e+061.008616e+062.942320e+051.447180e+05-2.262664e+05

 

We are able to execute it in python, but when tried in alteryx we are facing issue.

Some guidance will be much appreciated!!

 

Thanks 

2 REPLIES 2
aatalai
14 - Magnetar

@Hemanth22 would the mulit row tool help?

 

Please see workflow attached attached as a starting point. Let me know how you get on.

binuacs
20 - Arcturus

@Hemanth22 why don't you use the same python script in Alteryx? 

Labels