My problem is to move the year one day ahead so my calculations start with the first day of the year to be a Monday preferably. It can ignore the previous day e.g if 1st Jan is a Sunday, it can ignore it and push the Monday as the 1st day. The logic I have implemented is to only get the data of Mondays only e.g 1st day of the week.
X=[]
Y=[]
for item in data['Elements']:
for sub_item in item['TimeSpans']:
if (item['Date'].startswith("2017")):
iso_day = datetime.datetime.strptime(item['Date'], '%Y-%m-%dT%H:%M:%S').isocalendar() #Moving Date Logic
if (iso_day[2] == 1):
X.append(iso_day)
Y.append(sub_item['Value'])
How do I make it so show everyday instead of this Monday only whilst keeping my above yearly problem in mind? the condition in the if statement makes it start with Mondays only. How can I manipulate the statement so that it starts with Mondays initially but also then push out the data of other days as well when once started with a Monday.
my json is like this :
{
"SpotKey": "79",
"SpotName": "ELIX",
"Denomination": "eur/mwh",
"Elements": [
{
"Date": "2017-01-01T00:00:00",
"Base": 36.8696,
"Peak": 36.0125,
"TimeSpans": [
{
"TimeSpan": "00:00-01:00",
"Value": 46.43
},
{
"TimeSpan": "01:00-02:00",
"Value": 42.43
}
]
},
{
"Date": "2017-01-02T00:00:00",
"Base": 53.7413,
"Peak": 63.0317,
"TimeSpans": [
{
"TimeSpan": "00:00-01:00",
"Value": 41.18
},
{
"TimeSpan": "01:00-02:00",
"Value": 37.34
}
]
}
]
}