Skip to content

Commit

Permalink
Fix yet another deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Jan 23, 2024
1 parent fd48c82 commit 8643ec3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scmdata/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def timeseries(
raise NonUniqueMetadataError(_meta)

if time_axis is None:
columns = self._time_points.to_index()
columns = self._time_points.to_index().infer_objects()
elif time_axis == "year":
columns = self._time_points.years()
elif time_axis == "year-month":
Expand Down Expand Up @@ -906,8 +906,11 @@ def calc_seconds(x):
if len(np.unique(columns)) != len(columns):
raise ValueError(f"Ambiguous time values with time_axis = '{time_axis}'")

df.columns = pd.Index(columns, name="time")
df.index = pd.MultiIndex.from_frame(_meta)
if isinstance(columns, pd.Index):
df.columns = columns
else:
df.columns = pd.Index(columns, name="time")

if drop_all_nan_times:
df = df.dropna(how="all", axis="columns")
Expand Down

0 comments on commit 8643ec3

Please sign in to comment.