Skip to content

Commit

Permalink
fix: revert changes to timeseries.py
Browse files Browse the repository at this point in the history
  • Loading branch information
madtoinou committed Jul 17, 2023
1 parent 2beced0 commit 1290d9f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions darts/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,18 @@ def __init__(self, xa: xr.DataArray):
logger,
)
static_covariates = static_covariates.copy()
# single-row pandas is considered as a pd.Series, ie 'global static covariates'
static_covariates.index = (
[DEFAULT_GLOBAL_STATIC_COV_NAME]
if len(static_covariates) == 1
else self.components
)
elif isinstance(static_covariates, pd.Series):
static_covariates = static_covariates.to_frame().T
static_covariates.index = [DEFAULT_GLOBAL_STATIC_COV_NAME]
else: # None
pass

# prepare static covariates:
if static_covariates is not None:
static_covariates.index = (
self.components
if len(static_covariates) == self.n_components
else [DEFAULT_GLOBAL_STATIC_COV_NAME]
)
static_covariates.columns.name = STATIC_COV_TAG
# convert numerical columns to same dtype as series
# we get all numerical columns, except those that have right dtype already
Expand Down

0 comments on commit 1290d9f

Please sign in to comment.