-
Notifications
You must be signed in to change notification settings - Fork 13
Adds multilevel index, deprecation warnings, column name as callable #67
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
Conversation
|
|
||
| # TODO: allow this at some future point | ||
| if agg == "all": | ||
| raise AttributeError("cannot use 'all' as aggregate at this time") |
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.
What would happen if agg is something other than mean, min, max, etc?
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.
KeyError I believe. I'm fine with not protecting against that.
| item[col] = getattr(row[idx], agg) if row[idx] else None | ||
| if agg == "all": | ||
| for stat in _STAT_PROPERTIES: | ||
| item["{}-{}".format(col, stat)] = getattr(row[idx], stat) if row[idx] else None |
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.
Nice!
| raise AttributeError("cannot use 'all' as aggregate at this time") | ||
|
|
||
| if not callable(name_callable): | ||
| name_callable = lambda s: s.collection + "/" + s.name |
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.
Do we want to raise something here? It might be confusing if the user expects the columns to have custom names, but they aren't appearing and they wouldn't know why?
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.
Hmm.. this is mostly checking for None and making sure they user gave us something valid. I'll add a ticket to rethink this in the future.
tests/btrdb/test_transformers.py
Outdated
| """ | ||
| assert to_dateframe uses name lambda | ||
| """ | ||
| columns = ["stream0", "stream1", "stream2", "stream3"] |
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.
I don't really understand the purpose of columns here?
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.
yup, thats leftover. I've deleted in a new commit
No description provided.