I have a DataFrame called 'mydata', and if I do
len(mydata.loc['2015-9-2'])
It counts the number of rows in mydata that have that date, and returns a number like
1067
I have another DataFrame called 'yourdata' which looks something like
timestamp
51 2015-06-22
52 2015-06-23
53 2015-06-24
54 2015-06-25
43 2015-07-13
Now I want use each date in yourdata so instead of typing in each date
len(mydata.loc['2015-9-2'])
I can iterate through 'yourdata' using them like
len(mydata.loc[yourdata['timestamp']])
and produce a new DataFrame with the results or just add a new column to yourdata with the result for each date, but I'm lost as how to do this?
The following does not work
yourdata['result'] = len(mydata.loc[yourdata['timestamp']])
neither does this
yourdata['result'] = len(mydata.loc[yourdata.iloc[:,-3]])
this does work
yourdata['result'] = len(mydata.loc['2015-9-2'])
buts that no good as I want to use the date in each row not some fixed date.
Edit: first few rows of mydata
timestamp BPM
0 2015-08-30 16:48:00 65
1 2015-08-30 16:48:10 65
2 2015-08-30 16:48:15 66
3 2015-08-30 16:48:20 67
4 2015-08-30 16:48:30 70