Skip to content

TST: don't catch, but supress warnings in panel4d/panelnd #15705

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 1 commit into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ def _validate_categories(cls, categories, fastpath=False):
# we don't allow NaNs in the categories themselves

if categories.hasnans:
# NaNs in cats deprecated in 0.17,
# remove in 0.18 or 0.19 GH 10748
# NaNs in cats deprecated in 0.17
# GH 10748
msg = ('\nSetting NaNs in `categories` is deprecated and '
'will be removed in a future version of pandas.')
warn(msg, FutureWarning, stacklevel=3)
Expand Down
18 changes: 15 additions & 3 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,17 @@ def convert(self, values, nan_rep, encoding):

# we have a categorical
categories = self.metadata
self.data = Categorical.from_codes(self.data.ravel(),
codes = self.data.ravel()

# if we have stored a NaN in the categories
# then strip it; in theory we could have BOTH
# -1s in the codes and nulls :<
mask = isnull(categories)
if mask.any():
categories = categories[~mask]
codes[codes != -1] -= mask.astype(int).cumsum().values

self.data = Categorical.from_codes(codes,
categories=categories,
ordered=self.ordered)

Expand Down Expand Up @@ -3404,10 +3414,12 @@ def create_axes(self, axes, obj, validate=True, nan_rep=None,
if existing_table is not None:
indexer = len(self.non_index_axes)
exist_axis = existing_table.non_index_axes[indexer][1]
if append_axis != exist_axis:
if not array_equivalent(np.array(append_axis),
np.array(exist_axis)):

# ahah! -> reindex
if sorted(append_axis) == sorted(exist_axis):
if array_equivalent(np.array(sorted(append_axis)),
np.array(sorted(exist_axis))):
append_axis = exist_axis

# the non_index_axes info
Expand Down
Loading