Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.7K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Remove #NA values from list of pairs of values

Posted 5 years ago

Hi I have a list like below, I want to delete all entries in this list which have a second argument = "#NA" I tried DeleteCases function but some how its not working. Please help. Thanks, Nalina

data={{{2020, 1, 2, 0, 0, 0}, 2.48462802932}, {{2020, 1, 3, 0, 0, 0}, 
  2.47743873665}, {{2020, 1, 4, 0, 0, 0}, 
  "#NA"}, {{2020, 1, 5, 0, 0, 0}, "#NA"}, {{2020, 1, 6, 0, 0, 0}, 
  2.32779025386}, {{2020, 1, 7, 0, 0, 0}, 
  3.18982131454}, {{2020, 1, 8, 0, 0, 0}, 
  2.77782163231}, {{2020, 1, 9, 0, 0, 0}, 
  2.50983191849}, {{2020, 1, 10, 0, 0, 0}, 
  2.34758487156}, {{2020, 1, 11, 0, 0, 0}, "#NA"}}
POSTED BY: Nalina Vemparala
4 Replies

Hi Claudio. Yes, this works.

Thanks, Nalina

POSTED BY: Nalina Vemparala

Thanks, Rohit. Yes, this works.

Nalina

POSTED BY: Nalina Vemparala

Hi Nalina, try this way:

DeleteCases[data, {_, "#NA"}]

i1

(Oops, I didn't see that Rohit had already answered you ... sorry ^^)

POSTED BY: Claudio Chaib
Posted 5 years ago
data // Select[Last@# != "#NA" &]

data // DeleteCases[#, {_, "#NA"}] &
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard