You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "endremborza (via GitHub)" <gi...@apache.org> on 2023/03/29 22:09:05 UTC
[GitHub] [arrow] endremborza opened a new issue, #34782: empty table changes datatpye from ns to us
endremborza opened a new issue, #34782:
URL: https://github.com/apache/arrow/issues/34782
### Describe the bug, including details regarding any error messages, version, and platform.
Hello!
I don't know if this is specific to python but seems quite straightforward. I didn't look into it very deeply but its easy to reproduce so I thought I'd post it.
```python
import pyarrow as pa
import pyarrow.parquet as pq
pa.__version__
```
> '11.0.0'
```python
pt = pa.Table.from_pylist([], pa.schema([("d", pa.timestamp("ns"))]))
pt
```
```
pyarrow.Table
d: timestamp[ns]
----
d: [[]]
```
```python
pq.write_table(pt, "_.p")
pq.read_table("_.p")
```
```
pyarrow.Table
d: timestamp[us]
----
d: [[]]
```
very interestingly if I use pandas, it goes the other way around
```python
import pandas as pd
pt = pa.Table.from_pandas(pd.DataFrame({"d": pd.date_range("2023-01-01", "2023-01-02")}))
pt
```
```
pyarrow.Table
d: timestamp[ns]
----
d: [[2023-01-01 00:00:00.000000000,2023-01-02 00:00:00.000000000]]
```
```python
pq.write_table(pt, "_.p")
pq.read_table("_.p")
```
```
pyarrow.Table
d: timestamp[us]
----
d: [[2023-01-01 00:00:00.000000,2023-01-02 00:00:00.000000]]
```
### Component(s)
Python
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org