Skip to content

Commit d0a2304

Browse files
committed
BUG: DatetimeIndex with tz and single column name, return empty df (GH19157)
1 parent 1245f06 commit d0a2304

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pandas/core/frame.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,17 @@ def _get_axes(N, K, index=index, columns=columns):
518518
return _arrays_to_mgr([values], columns, index, columns,
519519
dtype=dtype)
520520
elif is_datetimetz(values):
521-
return self._init_dict({0: values}, index, columns, dtype=dtype)
521+
# GH19157
522+
if columns is not None:
523+
msg = ('Multiple column names defined for a series of '
524+
'DateTimeIndex with timezone. '
525+
'Expect a single column name instead.')
526+
assert len(columns) == 1, msg
527+
return self._init_dict({columns[0]: values}, index, columns,
528+
dtype=dtype)
529+
else:
530+
return self._init_dict({0: values}, index, columns,
531+
dtype=dtype)
522532

523533
# by definition an array here
524534
# the dtypes will be coerced to a single dtype

0 commit comments

Comments
 (0)