How can I avoid dataiku from changing the data types?

Options
mlv05
mlv05 Registered Posts: 2 ✭✭✭✭
Hi,

I have a dataset with a field that it's supposed to be a string, the field contains four numbers but sometimes the first number is a cero (like 0999) and dataiku keeps reeding them as numbers even when I declare them as text.

The biggest problem is that when I try to export the dataset, the first cero dissapears. How can I stop this?
Tagged:

Answers

  • Clément_Stenac
    Clément_Stenac Dataiker, Dataiku DSS Core Designer Posts: 753 Dataiker
    Options
    Hi, it is not possible to prevent that if no zero appears in the sample. If a zero-leading number appears in the sample (other than a decimal), DSS should consider it as text automatically.

    For some recipes, DSS will automatically propagate the forced "Text"

    However, there is a catch with Excel export: Excel export does not currently respect the types, and will always remove the leading zeros. To work around, use CSV export instead of Excel export. Beware that when importing the resulting CSV into Excel, Excel will also remove the leading zero, unless you force "text" format in the Excel import wizard.
  • mlv05
    mlv05 Registered Posts: 2 ✭✭✭✭
    Options
    Thank you for your answer. I'm actually using CSV export but it still removes the firts zero
  • Clément_Stenac
    Clément_Stenac Dataiker, Dataiku DSS Core Designer Posts: 753 Dataiker
    Options

    Could you verify this by opening the CSV file with a text editor like notepad, rather than Excel?

  • joostjansenn
    joostjansenn Registered Posts: 7 ✭✭✭✭
    Options

    Is the same true for the scoring recipe of a model? It seems to remove leading 0s for me in strings as well @Clément_Stenac

  • adiangels
    adiangels Registered Posts: 1 ✭✭✭
    Options

    Facing same problem where the zeroes are trimmed when data like 01 are used in the formula. Any known work around for this ?

  • Jurre
    Jurre Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered, Dataiku DSS Developer, Neuron 2022 Posts: 114 ✭✭✭✭✭✭✭
    Options

    Hi @adiangels
    , @joostjansenn
    and @mlv05
    ,

    My workaround for this is adding a prefix-letter (z for example) to values which possibly contain a leading zero, before exporting. Nothing gets stripped then.

    Hope this helps!

    Jurre

  • Diwei
    Diwei Registered Posts: 5 ✭✭✭✭
    Options

    HI Hi @adiangels , @joostjansenn and @mlv05 @Jurre
    ,

    I also do the same, add ' in front of numbers. Another alternative is to write in Excel directly into a folder instead of dataset, then all the types remain intact.

Setup Info
    Tags
      Help me…