04-05-1993:1.068
04-12-1993:1.079
04-19-1993:1.079
06-06-1994:1.065
06-13-1994:1.073
06-20-1994:1.079
I have text file for date-year-price for gas and i want to calculate the avg gas prices for year. So i tried to split,
with open('c:/Gasprices.txt','r') as f:
fullfile=[x.strip() for x in f.readlines()]
datesprices=[(x.split('-')[0], x.split(':')[1]) for x in fullfile]
print(datesprices)
But I can't get year and price data but data like this.
('04', '1.068'), ('04', '1.079')
please let me know what should i know.
and plus, please let me know how to use split data to calculate the avg price per year using a dictionary if you can.