Reputation: 17527
The closest answer I can find seems too complex: How I can create an interval column in pandas?
If I had a pandas data frame that looked like this:
+-------+
| Value |
+-------+
| 6 |
| 12 |
| 56 |
| 60 |
| 120 |
+-------+
How might I turn it into this?
+-------+-----------+
| Value | Interval |
+-------+-----------+
| 6 | |
| 12 | (6, 12] |
| 56 | (12, 56] |
| 60 | (56, 60] |
| 120 | (60, 120] |
+-------+-----------+
(N.B. This is a very simplified example, my real data-frame is big and so performance is an issue.)
Upvotes: 3
Views: 592