Skip to content

Commit

Permalink
Merge 1996333 into 5394784
Browse files Browse the repository at this point in the history
  • Loading branch information
bashtage committed Dec 21, 2020
2 parents 5394784 + 1996333 commit 910a3a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
6 changes: 4 additions & 2 deletions statsmodels/tsa/arima/estimators/tests/test_gls.py
Expand Up @@ -203,5 +203,7 @@ def test_arma_kwargs():
_, res2_imle = gls(endog, exog=exog, order=(1, 0, 1), n_iter=1,
arma_estimator_kwargs=arma_estimator_kwargs)
assert_equal(res2_imle.arma_estimator_kwargs, arma_estimator_kwargs)
assert_equal(res2_imle.arma_results[1].minimize_results.message,
b'CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH')
msg = res2_imle.arma_results[1].minimize_results.message
if isinstance(msg, bytes):
msg = msg.decode("utf-8")
assert_equal(msg, 'CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH')
21 changes: 12 additions & 9 deletions statsmodels/tsa/statespace/dynamic_factor_mq.py
Expand Up @@ -1525,7 +1525,7 @@ def construct_endog(cls, endog_monthly, endog_quarterly):
if not isinstance(endog_monthly, (pd.Series, pd.DataFrame)):
raise ValueError('Given monthly dataset is not a'
' Pandas object. ' + base_msg)
elif not endog_monthly.index.is_all_dates:
elif not endog_monthly.index.inferred_type in ("datetime64", "period"):
raise ValueError('Given monthly dataset has an'
' index with non-date values. ' + base_msg)
elif not getattr(endog_monthly.index, 'freqstr', 'N')[0] == 'M':
Expand All @@ -1544,7 +1544,7 @@ def construct_endog(cls, endog_monthly, endog_quarterly):
if not isinstance(endog_quarterly, (pd.Series, pd.DataFrame)):
raise ValueError('Given quarterly dataset is not a'
' Pandas object. ' + base_msg)
elif not endog_quarterly.index.is_all_dates:
elif not endog_quarterly.index.inferred_type in ("datetime64", "period"):
raise ValueError('Given quarterly dataset has an'
' index with non-date values. ' + base_msg)
elif not getattr(endog_quarterly.index, 'freqstr', 'N')[0] == 'Q':
Expand All @@ -1569,13 +1569,16 @@ def construct_endog(cls, endog_monthly, endog_quarterly):
axis=1)

# Make sure we didn't accidentally get duplicate column names
columns = endog.columns.values
for name, count in endog.columns.value_counts().items():
if count == 1:
continue
mask = columns == name
columns[mask] = [f'{name}{i + 1}' for i in range(count)]
endog.columns = columns
column_counts = endog.columns.value_counts()
if column_counts.max() > 1:
columns = endog.columns.values.astype(object)
for name in column_counts.index:
count = column_counts.loc[name]
if count == 1:
continue
mask = columns == name
columns[mask] = [f'{name}{i + 1}' for i in range(count)]
endog.columns = columns
else:
endog = endog_monthly.copy()
shape = endog_monthly.shape
Expand Down

0 comments on commit 910a3a0

Please sign in to comment.