From b1119c204cda0b1c54ad93f4185949381831bd58 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 29 May 2019 17:00:45 +1000 Subject: [PATCH] Update with comment from @gidden Co-authored by: gidden --- pyam/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyam/core.py b/pyam/core.py index d5b434fe3..49ecd984a 100644 --- a/pyam/core.py +++ b/pyam/core.py @@ -325,7 +325,7 @@ def swap_time_for_year(self, inplace=False): if "time" not in self.data: raise ValueError("time column must be datetime to use this method") - ret = copy.deepcopy(self) if not inplace else self + ret = self.copy() if not inplace else self ret.data["year"] = ret.data["time"].apply(lambda x: x.year) ret.data = ret.data.drop("time", axis="columns") @@ -1388,8 +1388,8 @@ def _check_rows(rows, check, in_range=True, return_test='any'): msg = 'Unknown checking type: {}' raise ValueError(msg.format(check.keys() - valid_checks)) - rows = rows.copy() if 'year' not in rows: + rows = rows.copy() rows['year'] = rows['time'].apply(lambda x: x.year) where_idx = set(rows.index[rows['year'] == check['year']]) \