rfeather

Why tibble is showing local time after reading feather file


I have a pandas dataframe with timestamps, like that:

df = pd.DataFrame({'a': [pd.Timestamp('2020-01-01 00:00:00')]})

I write it to a feather file with df.to_feather('a.feather'), and read it back in R with df <- arrow::read_feather('a.feather').

When I display it, I see

A tibble: 1 × 1 a
<dttm>
2020-01-01 01:00:00

Where did the 01:00:00 come from? How can I get rid of it?


Solution

  • ok, it seems that R or arrow is paying attention to some kind of global time zone variable. So the above behaviour can be fixed by adding

    Sys.setenv(TZ='GMT')
    

    in the beggining.

    Inspired by this: https://arrow.apache.org/docs/python/timestamps.html