For anyone coming to this question hoping to find an alternative way of processing unusual input here is some code.
In its essentials, the code reads the input file a line at a time, picks out the elements of dates and values, reassembles these into lines that pandas can readily parse and puts them into a StringIO object.
Pandas reads them from there, as if from a csv file. I have cribbed the grouping code from PiRSquared.
import pandas as pd
import re
from io import StringIO
file_name = 'temp.txt'
for_pd = StringIO()
with open(file_name) as f:
for line in f:
pieces = re.search(r'([0-9]{4}) - ([0-9]{,2}) - ([0-9]{,2}) - ([0-9.]+)', line).groups()
pieces = [int(_) for _ in pieces[:3]] + [pieces[3]]
print ('%.4i-%.2i-%.2i,%s' % tuple(pieces), file=for_pd)
for_pd.seek(0)
df = pd.read_csv(for_pd, header=None, names=['datetimes', 'values'], parse_dates=['datetimes'])
print (df.set_index('datetimes').groupby(pd.TimeGrouper('D')).mean().dropna())
print (df.set_index('datetimes').groupby(pd.TimeGrouper('W')).mean().dropna())
This is the output.
values
datetimes
1980-01-01 1.2
1980-01-02 1.3
1980-01-03 1.4
1980-01-04 1.5
1980-01-05 1.6
1980-01-06 1.7
1980-01-07 1.8
values
datetimes
1980-01-06 1.45
1980-01-13 1.80