Skip to content

numpy.split on non-UTC, tz-aware data undergoes UTC roundtrip #14042

Closed
@isacarnekvist

Description

@isacarnekvist

Code Sample, a copy-pastable example if possible

import pandas as pd
import numpy as np
indices = pd.date_range('2016-01-01 00:00:00+0200', freq='S', periods=10)
np.split(indices, indices_or_sections=[])
Out:
[DatetimeIndex(['2015-12-31 20:00:00+02:00', '2015-12-31 20:00:01+02:00',
               '2015-12-31 20:00:02+02:00', '2015-12-31 20:00:03+02:00',
               '2015-12-31 20:00:04+02:00', '2015-12-31 20:00:05+02:00',
               '2015-12-31 20:00:06+02:00', '2015-12-31 20:00:07+02:00',
               '2015-12-31 20:00:08+02:00', '2015-12-31 20:00:09+02:00'],
              dtype='datetime64[ns, pytz.FixedOffset(120)]', freq='S')]

Expected Output

[DatetimeIndex(['2016-01-01 00:00:00+02:00', '2016-01-01 00:00:01+02:00',
               '2016-01-01 00:00:02+02:00', '2016-01-01 00:00:03+02:00',
               '2016-01-01 00:00:04+02:00', '2016-01-01 00:00:05+02:00',
               '2016-01-01 00:00:06+02:00', '2016-01-01 00:00:07+02:00',
               '2016-01-01 00:00:08+02:00', '2016-01-01 00:00:09+02:00'],
              dtype='datetime64[ns, pytz.FixedOffset(120)]', freq='S')]

output of pd.show_versions()

In [16]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.2.0-38-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 25.2.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.0
statsmodels: None
xarray: None
IPython: 1.2.1
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: 3.1.1
numexpr: 2.6.1
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.8
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: 2.42.0
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions