When using the Alteryx.write() function, I am having a problem with it converting a datetime field to date only.
Solved! Go to Solution.
I'd recommend writing it as a string and converting it in-workflow. I have not seen this specific issue but I've done that with other datatypes (fixed decimal with greater than 6 digits)... Some of this truncation can occur when you are converting from Python to C at the C function level (at least that is my hypothesis...)
@ngrahl based off this little simulation, all is working fine:
I'm thinking that when you did the reset_index(), you forgot to put inplace=True as an argument ..:
Difficult to tell as you've cut your code off in the screenshot.
I've attached the demo workflow. Compare & Contrast to figure it out. Definitely check your reset_index step is saying inplace=True
Hi @ngrahl
It looks the error can occur if the first record in your input has 00:00:00.
but outputs correctly otherwise, which explains @BS_THE_ANALYST's result
This post goes more in depth and includes a nice hack to explicitly set the the data types to fix the issue.
Dan
I had a dig into the issue & I think I've solved it in a simple way. Have a test @danilang :
Essentially this forces the metadata when writing out with the metadata inside the Python tool.
Dan,
Thank you for the embedded link. I incorporated the additional Python code, and the problem is solved.