-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading dataset fully from dict #441
Conversation
framework/DataObjects/XDataSet.py
Outdated
@@ -216,16 +216,15 @@ def extendExistingEntry(self,rlz): | |||
# modify outputs to be pivot-dependent | |||
toRemove = [] | |||
# set up index vars for removal | |||
allDims = self.getDimensions() | |||
for var in rlz.keys(): | |||
for var in self.indexes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.indexes and allDims are lists, can we combine this "for" loop and "if" condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so. Like... toRemove = (var for var in self.indexes if var in allDims)
?
# pass # TODO need to make sure entries are all single entries! | ||
data[:,i] = values | ||
# set up collector as cached nd array of values | ||
self._collector = cached_ndarray.cNDarray(values=data,dtype=object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not a numpy standard array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. Given that we call asDataset()
right afterwords, we can probably get away without using the cached array.
Pull Request Description
Allows loading a DataSet directly from a dictionary using
data.load(dict, style='dict',dims={})
syntax.