Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit 20cea4c

Browse files
committed
Fix pandas merge operation due to recent pandas update
* pandas [issue \#35609](pandas-dev/pandas#35609)
1 parent da85337 commit 20cea4c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

mise/data.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -1565,12 +1565,14 @@ def key_h(idx): return str(idx.hour).zfill(2)
15651565
X_h['key_h'] = X_h.index.map(key_h)
15661566

15671567
## 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()
15701570
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()
15731574
X_h_spop = X_h_spop.rename(columns={'sea': 'sea_weekly'})
1575+
X_h_spop.set_index(X_h.index, inplace=True)
15741576

15751577
## new hourly residual column from daily residuals
15761578
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)
15881590
df_sea_hourly['key_h'] = df_sea_hourly.index
15891591

15901592
## 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()
15931595
X_h_hourly = X_h_hourly.rename(columns={'sea': 'sea_hourly'})
1596+
X_h_hourly.set_index(X_h.index, inplace=True)
15941597
## Subtract annual and weekly seasonality
15951598
X_h_spop['sea_hourly']= X_h_hourly['sea_hourly']
15961599
X_h_spop['resid'] = X_h_spop['resid_d'] - X_h_hourly['sea_hourly']

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ openpyxl==3.0.7
5959
opt-einsum==3.3.0
6060
optuna==2.3.0
6161
packaging==20.4
62-
pandas==1.1.4
62+
pandas==1.2.3
6363
partd==1.1.0
6464
patsy==0.5.1
6565
pbr==5.5.1

0 commit comments

Comments
 (0)