This is my code:
df = pd.read_csv(r'C:\Neuer Ordner\Strompreis.csv',
sep=';',
encoding = 'unicode_escape',
index_col=0,
parse_dates=True
)
dd = list()
for i in range (0,5):
x = df.values[len(df)-5]
y = df.values[len(df)-3]
z = 0.5*x + 0.7*y
dd.append(z)
dx = pd.DataFrame(dd)
df = pd.concat([df, dx])
This is the head of the input dataframe
Strompreis
Daten
2019-11-25 22:45:00 34.97
2019-11-25 23:00:00 48.61
2019-11-25 23:15:00 36.66
2019-11-25 23:30:00 36.74
2019-11-25 23:45:00 33.83
The expected Outputs must include the new values of z, like
Strompreis
Daten
2019-11-25 22:45:00 34.97
2019-11-25 23:00:00 48.61
2019-11-25 23:15:00 36.66
2019-11-25 23:30:00 36.74
2019-11-25 23:45:00 33.83
2019-11-25 00:00:00 41.5
2020-01-01 00:15:00 36.9
2020-01-01 00:30:00 45.9
...
the value of z2 must be calculated based on the new dataframe (including z1)