You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Krisztian Szucs (Jira)" <ji...@apache.org> on 2020/10/07 11:08:00 UTC
[jira] [Created] (ARROW-10210) [Python] Pandas roundtrip of
timestamp array ignores time unit
Krisztian Szucs created ARROW-10210:
---------------------------------------
Summary: [Python] Pandas roundtrip of timestamp array ignores time unit
Key: ARROW-10210
URL: https://issues.apache.org/jira/browse/ARROW-10210
Project: Apache Arrow
Issue Type: Bug
Components: Python
Reporter: Krisztian Szucs
When converting from an object type pandas series with np.datetime64[ns] we don't adjust the values based on the input numpy datetime unit to the target arrow time unit.
Reproducer test case:
{code:python}
@pytest.mark.parametrize('unit', ['s', 'ms', 'us', 'ns'])
def test_timestamp_array_pandas_roundtrip(unit):
tz = pytz.timezone('EST')
ty = pa.list_(pa.timestamp(unit, tz=tz))
# test list roundtrip
data = [[datetime(2000, 1, 1, 0, 0, tzinfo=tz)]]
arr = pa.array(data, type=ty)
assert arr.to_pylist() == data
# test pandas roundtrip
s = arr.to_pandas()
restored = pa.array(s, type=arr.type, from_pandas=True)
assert restored.equals(arr)
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)