Skip to content
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

Merged
merged 5 commits into from
Nov 28, 2017
Merged

Conversation

PaulTalbot-INL
Copy link
Collaborator


Pull Request Description

Allows loading a DataSet directly from a dictionary using data.load(dict, style='dict',dims={}) syntax.

@PaulTalbot-INL PaulTalbot-INL requested a review from mandd November 28, 2017 18:03
@@ -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:
Copy link
Collaborator

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?

Copy link
Collaborator Author

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)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@mandd mandd merged commit df9b669 into dataobject-rework Nov 28, 2017
@alfoa alfoa deleted the talbpaul/dataset-from-dict branch November 29, 2017 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants