def entsoe (self): client = EntsoePandasClient(api_key='5aa63adb-f9f7-47aa-8053-5cf531a3743f') start = pd.Timestamp(tomorrow, tz='Europe/Berlin') end = pd.Timestamp(aftertomorrow, tz='Europe/Berlin') country_code = 'DE' df = client.query_wind_and_solar_forecast(country_code, start=start, end=end, psr_type=None) df1 = client.query_generation_forecast(country_code, start=start, end=end ) df = self.kwh(df) df['hour']=df.index.hour df['date']=df.index.date df['weekDay']=df.index.dayofweek df['month']=df.index.month dfgroup = df.groupby(['date','hour']).agg({ 'Solar':'sum', 'Wind Offshore':'sum' ,'Wind Onshore':'sum' ,'weekDay':'max', 'month':'max'}) df2 = pd.DataFrame(data=df1) df2['hour']=df2.index.hour df2['date']=df2.index.date df1group = df2.groupby(['date','hour']).sum() df1group = df1group * 1000 df1group.rename(columns={0:'Generation'}, inplace=True) result = pd.concat([df1group,dfgroup], axis=1) idx = result.index result.index = result.index.set_levels([idx.get_level_values('date').astype(str), idx.get_level_values('hour')]) return result
# Time Series # NoMatchingDataError # ts_day_ahead = client.query_day_ahead_prices(country_code, start=start,end=end) ts_load = client.query_load(country_code, start=start, end=end) ts_load.to_csv('data_base/ts_load.csv') ts_load_forecast = client.query_load_forecast(country_code, start=start, end=end) ts_load_forecast.to_csv('data_base/ts_load_forecast.csv') ts_generation_forecast = client.query_generation_forecast(country_code, start=start, end=end) ts_generation_forecast.to_csv('data_base/ts_generation_forecast.csv') # Dataframes df_wind_and_solar_forecast = client.query_wind_and_solar_forecast( country_code, start=start, end=end, psr_type=None) df_wind_and_solar_forecast.to_csv('data_base/df_wind_and_solar_forecast.csv') df_generation = client.query_generation(country_code, start=start, end=end, psr_type=None) df_generation.to_csv('data_base/df_generation.csv')