Hi,
I have a python script. It runs in alteryx and exports to my local drive. I use to_csv to export it.
I want run the script through alteryx and spit out the files or the results of the files to the workflow.
Can this be done?
trying to use
alteryx.write(dummy,2) , where dummy is the dataframe and 2 is the number in the python anchor.
adding code:
for code, dummy in mainframe_data.groupby('Lookup'):
del dummy['Lookup']
if len(dummy) <=1000000:
dummy.to_csv(os.path.join(output_location,f"{(' '.join(dummy.File.unique()))[:6]}_Rules_{code}.csv"), sep='|', index=False)
alteryx.write(dummy,2)
else:
dummy.to_csv(os.path.join(output_location,f"{(' '.join(dummy.File.unique()))[:6]}_Rules_{code}.csv"), sep='|', index=False)
for file, dummy2 in dummy.groupby('File'):
if len(dummy2) <=1000000:
dummy2.to_csv(os.path.join(output_location,f"{(' '.join(dummy.File.unique()))[:6]}_Rules_{code}_{file.split('_')[1]}.csv"), sep='|', index=False)
alteryx.write(dummy2,2)
else:
dummy2.to_csv(os.path.join(output_location,f"{(' '.join(dummy.File.unique()))[:6]}_Rules_{code}_{file.split('_')[1]}.csv"), sep='|', index=False)
alteryx.write(dummy2,2)
del dummy2
del dummy
# Cleanup
del code
update - i needed to use "Alteryx" capitalize the A.
Now getting data in my browse tool. 1 brings it to my union tool (only 1 dataset showing). 2 brings to my browse tool (only 1 dataset showing) .
However I have many files i need to bring in, how come only one file is being read in? Expecting 3, I need them to concatentate!
I want to union them to one.