Skip to content

Commit

Permalink
Update with comment from @gidden
Browse files Browse the repository at this point in the history
Co-authored by: gidden <matthew.gidden@gmail.com>
  • Loading branch information
znicholls committed May 29, 2019
1 parent 545e680 commit b1119c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyam/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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']]) \
Expand Down

0 comments on commit b1119c2

Please sign in to comment.