Jump to content

Convert Nan to blank

Mike Harris

Recommended Posts

I’ve got a dataset with 1050 attributes (all numerical) and in some values inside of these I have the “NaN” string, which means that I can’t turn them in to continuous attributes from nominal. Is there a quick way/task to change all “NaN” values in all attributes to blank values without applying a formula to each attribute? I tried the fill and clean task but I couldn’t figure out a way to use this one for this purpose.
Thank you in advance

Link to comment
Share on other sites

Hi Mike! 

I see two feasible ways without inputting 1050 times:

  1. Applying ifelse formulas to all of them (you can use the copy-paste of formulas: you just write one formula, you select “Copy Formula”, then select all the columns and do “Paste Formula”)
    Pros: fewer tasks
    Cons: it depends on attribute names
  2. You convert all the columns into a long format, you do the operation on the unique remaining column and then convert back to wide format.
    Pros: it does not depend on attribute names
    Cons: more tasks and, potentially, more risk of running out of RAM (if the dataset is big, of course).

If you want, let me know which path you will choose 😉 

Have a nice day! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...