From the Python string function documentation
Return the number of non-overlapping occurrences of substring sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.
count
does not count overlapping occurrences.
If you want to count overlapping occurrences you can use regex with a lookahead assertion:
import re
print(len(re.findall('(?=aba)', 'ababa')))