Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.8K Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to replace "" with blank?

Posted 4 years ago
POSTED BY: Zhenyu Zeng
5 Replies

Hi

First there is a syntax error. Either there is a missing "@" or a missing pair of brackets "[ ]". The result you get is not 5 it just looks like a five actually it is 5 * "" which is not a numeric value.

Next you need to decide which value to use when replacing "" e.g. 0.

Maybe this is what you are looking for:

In[9]:= d = 
  Dataset@{<|"a" -> "", "b" -> 0.869667, "c" -> 0.069534|>, <|
      "a" -> 0.906971, "b" -> 0.614134, "c" -> 0.943003|>, <|
      "a" -> 0.46762, "b" -> 0.619722, "c" -> 0.237383|>, <|
      "a" -> 0.0532133, "b" -> "", "c" -> 0.160852|>, <|
      "a" -> 0.968014, "b" -> 0.609222, "c" -> 0.522014|>, <|
      "a" -> 0.331874, "b" -> 0.0132003, "c" -> 0.175512|>, <|
      "a" -> 0.274197, "b" -> 0.892181, "c" -> 0.560612|>, <|
      "a" -> 0.20482, "b" -> 0.503641, "c" -> 0.456528|>, <|
      "a" -> 0.607325, "b" -> 0.972514, "c" -> 0.468308|>, <|
      "a" -> 0.726064, "b" -> 0.976656, "c" -> 0.166471|>, <|
      "a" -> 0.576529, "b" -> 0.418368, "c" -> 0.422449|>, <|
      "a" -> 0.935738, "b" -> 0.730028, "c" -> 0.518465|>, <|
      "a" -> 0.167812, "b" -> 0.49489, "c" -> 0.18876|>, <|
      "a" -> 0.487007, "b" -> 0.632814, "c" -> 0.607625|>, <|
      "a" -> 0.542796, "b" -> 0.818752, "c" -> 0.915069|>, <|
      "a" -> 0.21409, "b" -> 0.443561, "c" -> 0.923162|>} /. "" -> 0;
g = 5*(Normal[d[All, "a"]][[1]])

Out[10]= 0

Robert

POSTED BY: Robert Nowak
Posted 4 years ago

Hello, Thanks for your reply. Your answer is certainly what I wanted. Have a nice day!

POSTED BY: Zhenyu Zeng
Posted 4 years ago
POSTED BY: Eric Rimbey
Posted 4 years ago

Hello, Thanks for your reply. I find documents in Mathematica, but I can't find detailed information about Missing. I feel that you know more than documents about Missing. Of course, I will use Missing in the future when I want to keep something empty.

POSTED BY: Zhenyu Zeng
Posted 4 years ago
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard