Dataiku forces column type, removes leading zeros
![mrs25](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar6.png)
Hello,
I am trying to store an ID column as a text/character column and not an integer column. How would I go about forcing the column type of a Dataiku Dataset? I forced it manually when viewing the dataset sample, but when I built the dataset again, it forced it back, interpreting the column as an integer instead of a character, removing the leading zeros.
I also tried to force the column type in the code (I am using R), but it didn't work. Additionally, the same column was interpreted as a character/text column earlier in the flow, but it's interpreted differently later on in the flow in my output dataset.
Please note that no transformations are done on this particular column throughout the flow.
Thank you.
Answers
-
CoreyS Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 1,150 ✭✭✭✭✭✭✭✭✭
Hi @mrs25
and welcome to the Dataiku Community. While you wait for a more complete response, in terms of padding a number with leading zeroes, I welcome you to this resource in our Knowledge Base: How to pad a number with leading zerosI hope this helps!
-
Thank you for this resource!
However, the column has varying lengths of strings, ranging from 5-8 digits, with some requiring varying lengths of leading zeros, so unfortunately, I cannot force pad them.
-
Jurre Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered, Dataiku DSS Developer, Neuron 2022 Posts: 114 ✭✭✭✭✭✭✭
Welcome @mrs25
,i add a prefix-character(for example the letter z) to ID-columns with numerical values in order to save leading zero's and force a type. Cheers, -Jurre
-
Ah I see! I will try this - thank you!
-
This is a clunky workaround. It would sure be nice if a string of numbers would just be treated as strings.