Free Trial

Alteryx Designer Desktop Discussions

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

python tool output help?

Matthew
11 - Bolide

ive created a density plot using python, and ive managed to print out a series of data points that define the shape of the density plot

 

NothingButThyme_0-1639863653357.png

 

NothingButThyme_1-1639863718196.png

 

i can make it print into the alteryx runtime log, but i cannot make it output through the Alteryx.Write() function

 

the problem is that i am getting the data points from a loop statement and i dont know how to compile it into a single DataFrame to pass to the write function..

 

can someone please help?

 

6 REPLIES 6
TheOC
15 - Aurora
15 - Aurora

hey @Matthew 

You will need to initialise a dataframe prior to the loop, and then append the new data to the dataframe, each iteration of the loop using the following:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.append.html 

Hope this helps,
TheOC


Bulien
Matthew
11 - Bolide

Thank you, I'll give it another try

 

I have tried this already though. The challenge I'm running into is I can't seem to figure out how to size the data frame to fit the data.. each iteration of the loop appears to contain an entire array of values (one complete layer of the density map)

Matthew
11 - Bolide

I'm getting very close. But two problems remain:

  1. It's rounding the value in the 'contourlabel' column.. but i don't understand how or why, because that label is a concatenated string
  2. Each contour layer is exiting the python tool as a concatenated array of values.. i can account for this by transforming it in Alteryx.. but i would much rather have it come out of the python tool with each XY pair as a separate row... (and not in scientific notation)

 

NothingButThyme_1-1640011871413.png

 

 

 

NothingButThyme_0-1640011847375.png

 

 

 

PhilipMannering
16 - Nebula
16 - Nebula

Hi @Matthew 

 

Do you want the data points, or is it ultimately just the plot that you want to keep?

Matthew
11 - Bolide

hey @PhilipMannering i still need the original datapoints, but i can always union them together after the macro processes the curves

 

edit: i see what youre asking.. yes i need the data points that make up each contour. i want to treat each layer as its own spatial object.. in fact, i'm hoping to get even more control over those layers.. i'd love to specify the confidence interval that each layer represents

KorkuSep
7 - Meteor

the solution to the Alteryx Python output problem is with numpy package, the key is to call the np.bool = np.bool_ after you import numpy into your notebook as seen in the image attached. This should solve problem 😎.

 

Labels
Top Solution Authors