Skip to content
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
2 changes: 1 addition & 1 deletion python/pyarrow/pandas_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ def _reconstruct_columns_from_metadata(columns, column_indexes):
if dtype == np.bytes_:
level = level.map(encoder)
# ARROW-13756: if index is timezone aware DataTimeIndex
if pandas_dtype == "datetimetz":
elif pandas_dtype == "datetimetz":
tz = pa.lib.string_to_tzinfo(
column_indexes[0]['metadata']['timezone'])
level = pd.to_datetime(level, utc=True).tz_convert(tz)
Expand Down
7 changes: 7 additions & 0 deletions python/pyarrow/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5241,6 +5241,13 @@ def roundtrip(df, schema=None):
schema=schema)


def test_bytes_column_name_to_pandas():
df = pd.DataFrame([[0.1, 0.2], [0.3, 0.4]], columns=[b'col1', b'col2'])
table = pa.Table.from_pandas(df)
assert table.column_names == ['col1', 'col2']
assert table.to_pandas().equals(df)


@pytest.mark.processes
def test_is_data_frame_race_condition():
# See https://github.com/apache/arrow/issues/39313
Expand Down
Loading