Skip to content

Commit

Permalink
Merge pull request #591 from LinkedEarth/Ens_repr
Browse files Browse the repository at this point in the history
EnsembleSeries display
  • Loading branch information
khider authored Jun 25, 2024
2 parents e1868d0 + 90fdf90 commit 843d61a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyleoclim/core/ensembleseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ class EnsembleSeries(MultipleSeries):
and visualization (e.g., envelope plot) that are unavailable to other classes.
'''

def __init__(self, series_list, label=None):
for i, ts in enumerate(series_list):
if ts.label is None:
series_list[i].label = f"#{i}" # assign labels if missing
self.series_list = series_list
self.label = label

Expand Down Expand Up @@ -1376,15 +1380,15 @@ def to_dataframe(self, axis = 'value'):

if axis == 'value':
for ts in self.series_list:
if ts.label is None:
if ts.label is None: # should no longer be necessary now that it's done in __init__
df_dict[idx]=ts.value
else:
df_dict[ts.label]=ts.value
idx+=1

elif axis == 'time':
for ts in self.series_list:
if ts.label is None:
if ts.label is None: # should no longer be necessary now that it's done in __init__
df_dict[idx]=ts.time
else:
df_dict[ts.label]=ts.time
Expand Down

0 comments on commit 843d61a

Please sign in to comment.