Skip to content

remove unreachable states, assert they are unreachable just in case #19180

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 2 commits into from
Jan 12, 2018
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
12 changes: 4 additions & 8 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2933,10 +2933,8 @@ def make_block(values, placement, klass=None, ndim=None, dtype=None,
elif dtype == np.bool_:
klass = BoolBlock
elif issubclass(vtype, np.datetime64):
if hasattr(values, 'tz'):
klass = DatetimeTZBlock
else:
klass = DatetimeBlock
assert not hasattr(values, 'tz')
klass = DatetimeBlock
elif is_datetimetz(values):
klass = DatetimeTZBlock
elif issubclass(vtype, np.complexfloating):
Expand Down Expand Up @@ -4696,10 +4694,8 @@ def form_blocks(arrays, names, axes):
if v.dtype != _NS_DTYPE:
v = conversion.ensure_datetime64ns(v)

if is_datetimetz(v):
datetime_tz_items.append((i, k, v))
else:
datetime_items.append((i, k, v))
assert not is_datetimetz(v)
datetime_items.append((i, k, v))
elif is_datetimetz(v):
datetime_tz_items.append((i, k, v))
elif issubclass(v.dtype.type, np.integer):
Expand Down