From 6e3e3eccd61b166665b766512ef93bbab3a8e065 Mon Sep 17 00:00:00 2001 From: Elaine Hale Date: Wed, 3 Oct 2018 19:53:42 -0600 Subject: [PATCH] read_gdx.Translator now captures copies of the GdxSymbol.dataframes rather than the originals. Closes #32 --- gdxpds/read_gdx.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gdxpds/read_gdx.py b/gdxpds/read_gdx.py index 342053e..9f8ddc8 100644 --- a/gdxpds/read_gdx.py +++ b/gdxpds/read_gdx.py @@ -40,7 +40,6 @@ ''' from collections import OrderedDict -import copy import logging # gdxpds needs to be imported before pandas to try to avoid library conflict on @@ -94,7 +93,7 @@ def dataframes(self): for symbol in self.__gdx: if not symbol.loaded: symbol.load() - self.__dataframes[symbol.name] = symbol.dataframe + self.__dataframes[symbol.name] = symbol.dataframe.copy() return self.__dataframes @property @@ -107,7 +106,7 @@ def dataframe(self, symbol_name): if not self.gdx[symbol_name].loaded: self.gdx[symbol_name].load() # This was returning { symbol_name: dataframe }, which seems intuitively off. - return self.gdx[symbol_name].dataframe + return self.gdx[symbol_name].dataframe.copy() def to_dataframes(gdx_file,gams_dir=None): """