We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem? Please describe. Output of datasets should be named tuples
Describe the solution you'd like E.g.
def create_namedtuple_from_dict(obj): if isinstance(obj, dict): fields = sorted(obj.keys()) namedtuple_type = namedtuple( typename="GenericObject", field_names=fields, rename=True, ) field_value_pairs = OrderedDict((str(field), create_namedtuple_from_dict(obj[field])) for field in fields) try: return namedtuple_type(**field_value_pairs) except TypeError: # Cannot create namedtuple instance so fallback to dict (invalid attribute names) return dict(**field_value_pairs) elif isinstance(obj, (list, set, tuple, frozenset)): return [create_namedtuple_from_dict(item) for item in obj] else: return obj
The text was updated successfully, but these errors were encountered:
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
Sorry, something went wrong.
No branches or pull requests
Is your feature request related to a problem? Please describe.
Output of datasets should be named tuples
Describe the solution you'd like
E.g.
The text was updated successfully, but these errors were encountered: