Skip to content

printing a dataframe ignores timezone information of columns containing datetime64 #9709

Closed
@satizabal

Description

@satizabal

I have a dataframe with a column containing dates (I do not want to use this column as the index of my dataframe). When printing the dataframe, the timezone information is lost. Directly accessing the .values shows the correct timezone.

This might be related to #6415

import pandas as pd

print "pandas version : ", pd.__version__

series = pd.to_datetime([1426374000000, 1426415697429], unit='ms').tz_localize('UTC').tz_convert('Europe/Berlin')
print '-- Printing series --'
print series
df = pd.DataFrame(series)
print '-- Printing df --'
print df
print '-- Printing df.values --'
print df.values
pandas version :  0.16.0
-- Printing series --
<class 'pandas.tseries.index.DatetimeIndex'>
[2015-03-15 00:00:00+01:00, 2015-03-15 11:34:57.429000+01:00]
Length: 2, Freq: None, Timezone: Europe/Berlin
-- Printing df --
                           0
0        2015-03-14 23:00:00
1 2015-03-15 10:34:57.429000
-- Printing df.values --
[['2015-03-15T00:00:00.000000000+0100']
 ['2015-03-15T11:34:57.429000000+0100']]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions