system.tag.queryTagHistory returns a dataset. After reading the documentation I don’t see any argument you can provide to get this functionality built in, but you can do some manual logic iterating through the dataset.
ds = system.tag.queryTagHistory(paths=tagPaths , returnSize = 24, aggregationMode='SimpleAverage', endDate=endTime, startDate=startTime)
rowsToDelete = []
for row in range(ds.getRowCount()):
# do some logic here to determine if the row should be dropped or not -
#note that you are getting multiple tag paths per row so you might have
# some tags that are negative and others that are positive
# up to you and your system to figure out what counts as a negative
if deleteCondition:
rowsToDelete.append(row)
ds = system.dataset.deleteRows(ds, rowsToDelete)
data['tagData'] = ds