I have a dataframe like this:
data = [['a', 10, '8/5/2021'], ['a', 15, '8/12/2021'], ['a', 8, '8/18/2021'], ['a', 5, '8/23/2021'], ['b', 3, '8/18/2021'], ['b', 10, '8/23/2021'], ['c', 8, '7/30/2021'], ['c', 12, '8/5/2021'], ['c', 3, '8/12/2021']]
df = pd.DataFrame(data, columns=['Name', 'Hours Slept', 'Date'])
What I'm trying to do is create a new dataframe that shows the name, # of times the person slept 10 hours or more, and the dates that correspond to those times. Something like this:
The code should be able to account/ignore NaN and the symbol '*' in the hours slept column.
I know I can do something like this to figure out the # of times the person slept 10 hours or more:
counter = 0
for i in df['Hours Slept']:
if i >= 10:
counter+=1
print(counter)
But I can't seem to figure out how to do it in combination with the duplicate Names and how to extract the date.
I cannot select specific Names like using df.loc["a"] because I'll like something that can iterate through all the names (my code has more than a, b, c).
Thank you in advance!

