Skip to content

REF: set non_index_axes at the end of create_axes #30067

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

Merged
merged 3 commits into from
Dec 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3662,15 +3662,15 @@ def get_object(self, obj, transposed: bool):
""" return the data for this obj """
return obj

def validate_data_columns(self, data_columns, min_itemsize):
def validate_data_columns(self, data_columns, min_itemsize, non_index_axes):
"""take the input data_columns and min_itemize and create a data
columns spec
"""

if not len(self.non_index_axes):
if not len(non_index_axes):
return []

axis, axis_labels = self.non_index_axes[0]
axis, axis_labels = non_index_axes[0]
info = self.info.get(axis, dict())
if info.get("type") == "MultiIndex" and data_columns:
raise ValueError(
Expand Down Expand Up @@ -3829,7 +3829,9 @@ def get_blk_items(mgr, blocks):
blk_items = get_blk_items(block_obj._data, blocks)
if len(new_non_index_axes):
axis, axis_labels = new_non_index_axes[0]
data_columns = self.validate_data_columns(data_columns, min_itemsize)
data_columns = self.validate_data_columns(
data_columns, min_itemsize, new_non_index_axes
)
if len(data_columns):
mgr = block_obj.reindex(
Index(axis_labels).difference(Index(data_columns)), axis=axis
Expand Down Expand Up @@ -3925,6 +3927,7 @@ def get_blk_items(mgr, blocks):
self.data_columns = new_data_columns
self.values_axes = vaxes
self.index_axes = new_index_axes
self.non_index_axes = new_non_index_axes

# validate our min_itemsize
self.validate_min_itemsize(min_itemsize)
Expand Down