'Append column to df based on values in of lists in array python
I have a df with a Time column and values at each of these time points that could be looking something like this just much bigger:
df <- data.frame("Time" = c(1,2,3,4,5,6,...), "value1" = c(1,2,7,45,2,0...), "value2" = c(...), ...)
I then have an array with multiple lists like this:
array([list([21.022]),
list([81.043, 81.884, 82.805, 83.406, 83.926, 84.287, 84.487, 84.967, 85.728, 86.249, 86.689]),
list([156.0, 156.681, 157.321, 158.363, 159.003, 159.524]),
list([170.535, 171.296, 171.896, 172.617, 172.897, 173.658, 174.259, 175.06, 175.58, 175.941])],
dtype=object)
These lists all represent time points in the df above.
I would like to append a column with 1 or 0 to the df based on whether the Time values are in any of the lists or not.
Thank you all for your help!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
