I have a Pandas dataframe with datetime elements ('date') and floats ('cups) and am wondering if there's anyway to use np.vstack()
to stack the two.
Previously, I had converted the datetime elements to floats and used vstack()
without issue. However, I am using xx
to update a scatterplot with a slider and, since I would like the plot to use dates, can no longer use this method.
xx = np.vstack((df['date'], df['cups']))
scat.set_offsets(xx.T)
I see that there's been a similar question, but I'm not sure how to adapt the answer given there to my situation: Can ndarray store datetime and float?.
Since the end-goal is to call set_offsets
with the right kind of structure, the solution need not use vstack. I'm just not sure how to get the structure set_offsets
needs without using vstack
.