How to remove from the data the rows of with fixed number of elements?How to Import random elements of huge...
Can we "borrow" our answers to populate our own websites?
Can 5 Aarakocra PCs summon an Air Elemental?
What is a DAG (Graph Theory)?
Why did the villain in the first Men in Black movie care about Earth's Cockroaches?
Updating Statistics: Estimated Number of Rows not equal to Actual for Index Scan. Why?
Current across a wire with zero potential difference
Book where a space ship journeys to the center of the galaxy to find all the stars had gone supernova
In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?
Why do neural networks need so many training examples to perform?
Sprint is 2 week and 40-stories
How does Leonard in "Memento" remember reading and writing?
Prioritising polygons in QGIS
Does it take energy to move something in a circle?
systemd service won't start nodejs
Does diversity provide anything that meritocracy does not?
How can the probability of a fumble decrease linearly with more dice?
Is there a verb that means to inject with poison?
How to not let the Identify spell spoil everything?
How can I play a serial killer in a party of good PCs?
Best way to strengthen a wheel?
Bash script to truncate subject line of incoming email
Boss asked me to sign a resignation paper without a date on it along with my new contract
Why did Luke use his left hand to shoot?
After checking in online, how do I know whether I need to go show my passport at airport check-in?
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
3 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
3 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 3 hours ago
John Taylor
asked 3 hours ago
John TaylorJohn Taylor
736211
736211
1
$begingroup$
Maybe you ask forDeleteCases[data, _?(Length[#] == 3 &)]
...
$endgroup$
– Henrik Schumacher
3 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
3 hours ago
add a comment |
1
$begingroup$
Maybe you ask forDeleteCases[data, _?(Length[#] == 3 &)]
...
$endgroup$
– Henrik Schumacher
3 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
3 hours ago
1
1
$begingroup$
Maybe you ask for
DeleteCases[data, _?(Length[#] == 3 &)]
...$endgroup$
– Henrik Schumacher
3 hours ago
$begingroup$
Maybe you ask for
DeleteCases[data, _?(Length[#] == 3 &)]
...$endgroup$
– Henrik Schumacher
3 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
3 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
3 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 2 hours ago
answered 3 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 3 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
3 hours ago
$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
3 hours ago