How to remove from the data the rows of with fixed number of elements?How to Import random elements of huge...
Why did the villain in the first Men in Black movie care about Earth's Cockroaches?
Why do all the books in Game of Thrones library have their covers facing the back of the shelf?
Why do we have to make "peinlich" start with a capital letter and also end with -s in this sentence?
Existence of Riemann surface, holomorphic maps
False written accusations not made public - is there law to cover this?
The effect of fishing on total land area needed to feed an island settlement
Why is Agricola named as such?
Can you tell from a blurry photo if focus was too close or too far?
Can the "Friends" spell be used without making the target hostile?
Current across a wire with zero potential difference
What senses are available to a corpse subjected to a Speak with Dead spell?
Does diversity provide anything that meritocracy does not?
Early credit roll before the end of the film
What is the wife of a henpecked husband called?
Eww, those bytes are gross
After checking in online, how do I know whether I need to go show my passport at airport check-in?
Potential client has a problematic employee I can't work with
What game did these black and yellow dice come from?
Why is it that Bernie Sanders is always called a "socialist"?
How can the probability of a fumble decrease linearly with more dice?
Bash script to truncate subject line of incoming email
How do you voice extended chords?
Is there a lava-breathing lizard creature (that could be worshipped by a cult) in 5e?
Should I always close BufferedReader?
How to remove from the data the rows of with fixed number of elements?
How to Import random elements of huge data filesImport data from first/last 100 rows of a fileHow to remove outliers from dataRemove the odd element from a listRemove noise from dataRemove rows in table that have rows with missing valuesHow to extract first 9 rows from every block of 22 rows?How to remove circled noise from imageHow do I remove particular $x$ and $y$ values from a list of data points?How to select the data in a given way?
$begingroup$
Consider the data which has the form
data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}
How to remove the rows containing three elements from the data?
I.e., to obtain
dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}
data filtering
$endgroup$
add a comment |
$begingroup$
Consider the data which has the form
data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}
How to remove the rows containing three elements from the data?
I.e., to obtain
dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}
data filtering
$endgroup$
1
$begingroup$
Maybe you ask forDeleteCases[data, _?(Length[#] == 3 &)]
...
$endgroup$
– Henrik Schumacher
4 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
4 hours ago
add a comment |
$begingroup$
Consider the data which has the form
data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}
How to remove the rows containing three elements from the data?
I.e., to obtain
dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}
data filtering
$endgroup$
Consider the data which has the form
data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}
How to remove the rows containing three elements from the data?
I.e., to obtain
dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}
data filtering
data filtering
edited 4 hours ago
John Taylor
asked 4 hours ago
John TaylorJohn Taylor
736211
736211
1
$begingroup$
Maybe you ask forDeleteCases[data, _?(Length[#] == 3 &)]
...
$endgroup$
– Henrik Schumacher
4 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
4 hours ago
add a comment |
1
$begingroup$
Maybe you ask forDeleteCases[data, _?(Length[#] == 3 &)]
...
$endgroup$
– Henrik Schumacher
4 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
4 hours ago
1
1
$begingroup$
Maybe you ask for
DeleteCases[data, _?(Length[#] == 3 &)]
...$endgroup$
– Henrik Schumacher
4 hours ago
$begingroup$
Maybe you ask for
DeleteCases[data, _?(Length[#] == 3 &)]
...$endgroup$
– Henrik Schumacher
4 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
4 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
4 hours ago
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Any one of these would do:
Cases[data, Except[_?(Length[#] == 3 &)]]
DeleteCases[data, _?(Length[#] == 3 &)]
Select[data, Length[#] != 3 &]
Delete[data, Position[data, _?(Length[#] == 3 &)]]
data /. {_, _, _} -> Nothing
data /. {Repeated[_, {3}]} -> Nothing
They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}
$endgroup$
add a comment |
$begingroup$
Also
Pick[data, Unitize[-3 + Length /@ data], 1]
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192243%2fhow-to-remove-from-the-data-the-rows-of-with-fixed-number-of-elements%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Any one of these would do:
Cases[data, Except[_?(Length[#] == 3 &)]]
DeleteCases[data, _?(Length[#] == 3 &)]
Select[data, Length[#] != 3 &]
Delete[data, Position[data, _?(Length[#] == 3 &)]]
data /. {_, _, _} -> Nothing
data /. {Repeated[_, {3}]} -> Nothing
They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}
$endgroup$
add a comment |
$begingroup$
Any one of these would do:
Cases[data, Except[_?(Length[#] == 3 &)]]
DeleteCases[data, _?(Length[#] == 3 &)]
Select[data, Length[#] != 3 &]
Delete[data, Position[data, _?(Length[#] == 3 &)]]
data /. {_, _, _} -> Nothing
data /. {Repeated[_, {3}]} -> Nothing
They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}
$endgroup$
add a comment |
$begingroup$
Any one of these would do:
Cases[data, Except[_?(Length[#] == 3 &)]]
DeleteCases[data, _?(Length[#] == 3 &)]
Select[data, Length[#] != 3 &]
Delete[data, Position[data, _?(Length[#] == 3 &)]]
data /. {_, _, _} -> Nothing
data /. {Repeated[_, {3}]} -> Nothing
They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}
$endgroup$
Any one of these would do:
Cases[data, Except[_?(Length[#] == 3 &)]]
DeleteCases[data, _?(Length[#] == 3 &)]
Select[data, Length[#] != 3 &]
Delete[data, Position[data, _?(Length[#] == 3 &)]]
data /. {_, _, _} -> Nothing
data /. {Repeated[_, {3}]} -> Nothing
They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}
edited 3 hours ago
answered 4 hours ago
MarcoBMarcoB
36.3k556112
36.3k556112
add a comment |
add a comment |
$begingroup$
Also
Pick[data, Unitize[-3 + Length /@ data], 1]
$endgroup$
add a comment |
$begingroup$
Also
Pick[data, Unitize[-3 + Length /@ data], 1]
$endgroup$
add a comment |
$begingroup$
Also
Pick[data, Unitize[-3 + Length /@ data], 1]
$endgroup$
Also
Pick[data, Unitize[-3 + Length /@ data], 1]
answered 4 hours ago
kglrkglr
186k10202421
186k10202421
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192243%2fhow-to-remove-from-the-data-the-rows-of-with-fixed-number-of-elements%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
Maybe you ask for
DeleteCases[data, _?(Length[#] == 3 &)]
...$endgroup$
– Henrik Schumacher
4 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
4 hours ago