Timeline for How do I create a new column where the values are selected based on an existing column?
Current License: CC BY-SA 4.0
37 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 8 at 18:37 | comment | added | wjandrea |
@KarlKnechtel Reading this back now, the more important thing is that there's only one criterion, which lets you use np.where instead of having to use np.select . I guess I misphrased my comment.
|
|
Jun 8 at 18:26 | comment | added | Karl Knechtel | @wjandrea if you insist that the distinction between doing this for a single column and for multiple columns is important, then this question needs to be clear that it's only about the single-column case - so I edited the title accordingly. | |
Jun 8 at 18:26 | history | edited | Karl Knechtel | CC BY-SA 4.0 |
edited title
|
Mar 10 at 12:11 | comment | added | cottontail |
Since pandas 2.2.0, you can use case_when (a syntax useful in SQL in the context in the OP). See this answer for a demo.
|
|
Jan 26 at 18:30 | answer | added | Gabe | timeline score: 1 | |
Sep 24, 2023 at 23:11 | comment | added | wjandrea | Related: Create new column based on values from other columns / apply a function of multiple columns, row-wise in Pandas (same idea, but the selection criteria are based on multiple columns) | |
Sep 24, 2023 at 23:05 | history | edited | wjandrea | CC BY-SA 4.0 |
Better title. Simplify formatting.
|
Sep 24, 2023 at 22:46 | history | reopened | wjandrea python Users with the python badge can single-handedly close python questions as duplicates and reopen them as needed. | ||
Sep 24, 2023 at 8:55 | history | closed | Karl Knechtel python Users with the python badge can single-handedly close python questions as duplicates and reopen them as needed. | Duplicate of Create new column based on values from other columns / apply a function of multiple columns, row-wise in Pandas | |
Jan 25, 2023 at 19:34 | answer | added | drGabriel | timeline score: 1 | |
S Nov 20, 2022 at 14:04 | history | rollback | Dharman♦ |
Rollback to Revision 6 - Edit approval overridden by post owner or moderator
|
|
Oct 24, 2022 at 18:28 | history | suggested | Andrew | CC BY-SA 4.0 |
added dataframe
|
Oct 23, 2022 at 1:00 | review | Suggested edits | |||
S Nov 20, 2022 at 14:04 | |||||
Jun 20, 2022 at 3:09 | history | edited | Mateen Ulhaq | CC BY-SA 4.0 |
Shorten.
|
Mar 4, 2022 at 23:16 | answer | added | rubengavidia0x | timeline score: 0 | |
Oct 18, 2021 at 9:11 | answer | added | sammywemmy | timeline score: 2 | |
Jul 2, 2021 at 8:17 | answer | added | xiaotong xu | timeline score: 3 | |
Jan 17, 2021 at 13:00 | answer | added | Mykola Zotko | timeline score: 6 | |
S Jul 26, 2020 at 0:18 | history | suggested | daaawx | CC BY-SA 4.0 |
clarified question (using = may be confusing for readers)
|
Jul 25, 2020 at 22:52 | review | Suggested edits | |||
S Jul 26, 2020 at 0:18 | |||||
Dec 8, 2019 at 18:42 | answer | added | Yaakov Bressler | timeline score: 0 | |
Oct 10, 2019 at 14:30 | answer | added | Jaroslav Bezděk | timeline score: 2 | |
Jul 3, 2019 at 22:11 | history | protected | Sheldore | ||
Mar 6, 2019 at 17:51 | answer | added | Hossein Kalbasi | timeline score: 26 | |
S Jan 22, 2019 at 16:16 | history | suggested | nick |
updated tags
|
|
Jan 22, 2019 at 15:26 | review | Suggested edits | |||
S Jan 22, 2019 at 16:16 | |||||
Sep 7, 2018 at 21:35 | history | edited | jpp |
edited tags
|
|
May 25, 2018 at 21:12 | review | Suggested edits | |||
May 26, 2018 at 1:38 | |||||
Feb 15, 2017 at 21:43 | answer | added | boot-scootin | timeline score: 25 | |
Feb 8, 2017 at 13:04 | answer | added | bli | timeline score: 30 | |
Jul 2, 2015 at 0:27 | answer | added | cheekybastard | timeline score: 186 | |
May 10, 2015 at 17:10 | history | edited | Alex Riley | CC BY-SA 3.0 |
deleted 2 characters in body
|
Jun 6, 2014 at 4:43 | answer | added | acharuva | timeline score: 29 | |
Nov 11, 2013 at 19:56 | vote | accept | user7289 | ||
Nov 11, 2013 at 19:12 | review | Close votes | |||
Feb 27, 2014 at 10:52 | |||||
Nov 11, 2013 at 19:03 | answer | added | unutbu | timeline score: 1051 | |
Nov 11, 2013 at 18:52 | history | asked | user7289 | CC BY-SA 3.0 |