Group Abstract Group Abstract

Message Boards Message Boards

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

Clean data based on row values

I have a large file of data with the following structure:

data = {{700., 0.1, 0.2, 0.3}, {800., 10., 30., 40.}, {900., 0.1, 1.4,
     15.}};

What I would like is to clean the data, eliminating rows whose maximum value from the 2nd column onwards is less than 1.

In the simplified example I have used before, only the 1st row should be deleted.

Does anyone know how can this be done using Mathematica?

Thanks in advance for any help!

3 Replies
Posted 4 years ago

Although Henrik’s suggestion will definitely work, I.e. select the rows that you do want, just for completeness, you may also like to look at DeleteCases. That function allows you to remove the rows you don’t want.

https://reference.wolfram.com/language/ref/DeleteCases.html

Cheers Andy

POSTED BY: Andrew Burnett

One way might be:

Select[data, Max[#[[2 ;;]]] >=  1 &]
POSTED BY: Henrik Schachner

Thank you very much for your reply!

It is a simple and fast method.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard