Timeline for Replacing numeric values with a string in a particular list column
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 29 at 2:57 | answer | added | Syed | timeline score: 1 | |
Mar 29 at 0:42 | answer | added | E. Chan-López | timeline score: 1 | |
Mar 29 at 0:14 | answer | added | eldo | timeline score: 2 | |
Oct 27, 2022 at 6:00 | history | tweeted | twitter.com/StackMma/status/1585511630691000321 | ||
Oct 26, 2022 at 18:51 | comment | added | Joy | Thanks Bob and Nasser. | |
Oct 26, 2022 at 10:24 | answer | added | IntroductionToProbability | timeline score: 1 | |
Oct 25, 2022 at 7:33 | history | became hot network question | |||
Oct 25, 2022 at 5:36 | history | edited | Syed | CC BY-SA 4.0 |
added 91 characters in body; edited title
|
Oct 25, 2022 at 0:46 | comment | added | Bob Hanlon |
@NicholasG - There is no advantage to either Rule or RuleDelayed in this case. I just tend to use RuleDelayed unless there is a reason not to.
|
|
Oct 25, 2022 at 0:39 | comment | added | Nicholas G |
To explain @BobHanlon 's beautiful answer, he creates a RuleDelayed that would replace something with a replacement. Then defines the something as a list with two elements, the first can be anything, but the second must be a number. All those lists are replaced by their same first element and as a second element the word "DEAD." Beautiful! Rule seems to work just as well as RuleDelayed for me, so he might explain if the latter has some advantage that I don't see.
|
|
Oct 25, 2022 at 0:23 | comment | added | Bob Hanlon |
lis /. {yrS_, yrF_?NumericQ} :> {yrS, "DEAD"}
|
|
Oct 24, 2022 at 23:49 | answer | added | Nasser | timeline score: 3 | |
Oct 24, 2022 at 23:35 | comment | added | Edmund | What have you tried? | |
S Oct 24, 2022 at 23:29 | review | First questions | |||
Oct 25, 2022 at 5:52 | |||||
S Oct 24, 2022 at 23:29 | history | asked | Joy | CC BY-SA 4.0 |