-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
REF: io.pytables operate on DataFrames instead of Blocks #29871
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
asvs seem like noise:
|
…n-pytables-blocks
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.
lgtm, minor comments, pls rebase
…n-pytables-blocks
rebased+green |
block = make_block(values, placement=np.arange(len(cols_)), ndim=2) | ||
mgr = BlockManager([block], [cols_, index_]) | ||
frames.append(DataFrame(mgr)) | ||
if isinstance(values, np.ndarray): |
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 would merge this with the line above
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 dont understand the suggestion
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.
put this
if values.ndim == 1 and isinstance(values, np.ndarray):
values = values.reshape((1, values.shape[0]))
inside this if
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.
the purpose of that check is orthogonal to the purpose of this check. 4341-4348 are logically grouped together
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.
ok, I don't particularly like the fact that we have to construct things like this, but i guess ok
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.
ok to merge like this or handle suggestions as followup.
@@ -3100,17 +3099,23 @@ def read(self, start=None, stop=None, **kwargs): | |||
axes.append(ax) | |||
|
|||
items = axes[0] | |||
blocks = [] | |||
dfs = [] | |||
|
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 think it would be better to use a list comprehension here and make a function for the DataFrame creation (e.g. lines 3106-3110), but can be a followup
dfs.append(df) | ||
|
||
if len(dfs) > 0: | ||
out = concat(dfs, axis=1) |
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 actually find this simpler as a chained operation
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.
ok. will change in follow-up (since CI is failing for unrelated reasons right now)
block = make_block(values, placement=np.arange(len(cols_)), ndim=2) | ||
mgr = BlockManager([block], [cols_, index_]) | ||
frames.append(DataFrame(mgr)) | ||
if isinstance(values, np.ndarray): |
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.
ok, I don't particularly like the fact that we have to construct things like this, but i guess ok
thanks |
Wouldn't be surprised if there is a perf hit here, will run asvs.