Wednesday, 5 May 2021

Take time points, and make labels against datetime object to correlate for things around points

I'm trying to use the usual times I take medication (so + 4 hours on top of that) and fill in a data frame with a label, of being 2,1 or 0, for when I am on this medication, or for the hour after the medication as 2 for just being off of the medication.

As an example of the dataframe I am trying to add this column too,

<bound method NDFrame.to_clipboard of                           id  sentiment  magnitude  angry  disgusted  fearful  \
created                                                                         
2020-05-21 12:00:00     23.0  -0.033333        0.5    NaN        NaN      NaN   
2020-05-21 12:15:00      NaN        NaN        NaN    NaN        NaN      NaN   
2020-05-21 12:30:00      NaN        NaN        NaN    NaN        NaN      NaN   
2020-05-21 12:45:00      NaN        NaN        NaN    NaN        NaN      NaN   
2020-05-21 13:00:00      NaN        NaN        NaN    NaN        NaN      NaN   
...                      ...        ...        ...    ...        ...      ...   
2021-04-20 00:45:00      NaN        NaN        NaN    NaN        NaN      NaN   
2021-04-20 01:00:00      NaN        NaN        NaN    NaN        NaN      NaN   
2021-04-20 01:15:00      NaN        NaN        NaN    NaN        NaN      NaN   
2021-04-20 01:30:00      NaN        NaN        NaN    NaN        NaN      NaN   
2021-04-20 01:45:00  46022.0  -1.000000        1.0    NaN        NaN      NaN   

                     happy  neutral  sad  surprised  
created                                              
2020-05-21 12:00:00    NaN      NaN  NaN        NaN  
2020-05-21 12:15:00    NaN      NaN  NaN        NaN  
2020-05-21 12:30:00    NaN      NaN  NaN        NaN  
2020-05-21 12:45:00    NaN      NaN  NaN        NaN  
2020-05-21 13:00:00    NaN      NaN  NaN        NaN  
...                    ...      ...  ...        ...  
2021-04-20 00:45:00    NaN      NaN  NaN        NaN  
2021-04-20 01:00:00    NaN      NaN  NaN        NaN  
2021-04-20 01:15:00    NaN      NaN  NaN        NaN  
2021-04-20 01:30:00    NaN      NaN  NaN        NaN  
2021-04-20 01:45:00    NaN      NaN  NaN        NaN  

[32024 rows x 10 columns]>

And the data for the timestamps for when i usually take my medication,

['09:00 AM', '12:00 PM', '03:00 PM']

How would I use those time stamps to get this sort of column information?

Thanks



from Take time points, and make labels against datetime object to correlate for things around points

No comments:

Post a Comment