I have a table like this
timestamp avg_hr hr_quality avg_rr rr_quality activity sleep_summary_id
1422404668 66 229 0 0 13 78
1422404670 64 223 0 0 20 78
1422404672 64 216 0 0 11 78
1422404674 66 198 0 40 9 78
1422404676 65 184 0 30 3 78
1422404678 64 173 0 10 17 78
1422404680 66 199 0 20 118 78
I'm trying to group the data by timestamp
,sleep id
and rr_quality
, where rr_quality
is > 0
I've tried the following and none of them seems to work
df3 = df2.groupby([df2.index.hour,'sleep_summary_id',df2['rr_quality']>0])
df3 = df2.groupby([df2.index.hour,'sleep_summary_id','rr_quality'>0])
df3 = df2.groupby([df2.index.hour,'sleep_summary_id',['rr_quality']>0])
All of them returns a keyerror.
EDIT:
Also can't seem to be able to pass more than one filter at a time. I tried the following:
df2[df2['rr_quality'] >= 150, df2['hr_quality'] > 200]
df2[df2['rr_quality'] >= 150, ['hr_quality'] > 200]
df2[[df2['rr_quality'] >= 150, ['hr_quality'] > 200]]
returns: TypeError: 'Series' objects are mutable, thus they cannot be hashed