@@ -1565,12 +1565,14 @@ def key_h(idx): return str(idx.hour).zfill(2)
1565
1565
X_h ['key_h' ] = X_h .index .map (key_h )
1566
1566
1567
1567
## compute hourly populated seasonality from daily residuals
1568
- X_h_spop = df_sea_annual .merge (X_h , how = 'left ' ,
1569
- on = 'key_md' , left_index = True , validate = "1:m" ).dropna ()
1568
+ X_h_spop = df_sea_annual .merge (X_h , how = 'right ' ,
1569
+ on = 'key_md' , validate = "1:m" ).dropna ()
1570
1570
X_h_spop = X_h_spop .rename (columns = {'sea' : 'sea_annual' })
1571
- X_h_spop = df_sea_weekly .merge (X_h_spop , how = 'left' ,
1572
- on = 'key_w' , left_index = True , validate = "1:m" ).dropna ()
1571
+ X_h_spop .set_index (X_h .index , inplace = True )
1572
+ X_h_spop = df_sea_weekly .merge (X_h_spop , how = 'right' ,
1573
+ on = 'key_w' , validate = "1:m" ).dropna ()
1573
1574
X_h_spop = X_h_spop .rename (columns = {'sea' : 'sea_weekly' })
1575
+ X_h_spop .set_index (X_h .index , inplace = True )
1574
1576
1575
1577
## new hourly residual column from daily residuals
1576
1578
X_h_spop ['resid_d' ] = X_h_spop ['raw' ] - X_h_spop ['sea_annual' ] - X_h_spop ['sea_weekly' ]
@@ -1588,9 +1590,10 @@ def key_h(idx): return str(idx.hour).zfill(2)
1588
1590
df_sea_hourly ['key_h' ] = df_sea_hourly .index
1589
1591
1590
1592
## merge hourly seasonality to orignal hourly DataFram
1591
- X_h_hourly = df_sea_hourly .merge (X_h , how = 'left ' ,
1592
- on = 'key_h' , left_index = True , validate = "1:m" ).dropna ()
1593
+ X_h_hourly = df_sea_hourly .merge (X_h , how = 'right ' ,
1594
+ on = 'key_h' , validate = "1:m" ).dropna ()
1593
1595
X_h_hourly = X_h_hourly .rename (columns = {'sea' : 'sea_hourly' })
1596
+ X_h_hourly .set_index (X_h .index , inplace = True )
1594
1597
## Subtract annual and weekly seasonality
1595
1598
X_h_spop ['sea_hourly' ]= X_h_hourly ['sea_hourly' ]
1596
1599
X_h_spop ['resid' ] = X_h_spop ['resid_d' ] - X_h_hourly ['sea_hourly' ]
0 commit comments