I've an json array with data like
[{
'Id': 2837
'Date': datetime.date(2020, 01, 01),
'Caption': 'asdf'
}, {
'Id': 2838
'Date': datetime.date(2020, 01, 01),
'Caption': 'fasd'
},{
'Id': 2839
'Date': datetime.date(2020, 01, 04),
'Caption': 'sdfa'
}]
and a dataframe with a row for each date
DATE LEN
0 2020-01-01 NaN
1 2020-01-02 NaN
2 2020-01-03 NaN
3 2020-01-04 NaN
4 2020-01-05 NaN
5 2020-01-06 NaN
Now I would like to count the elements in the json array and write them into the dataframe. I tried
df['LEN'] = len([x for x in jsonArray if x['Date'] == df['DATE']])
but it's not working. I get an error
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
What am I doing wrong?