Code Sample, a copy-pastable example if possible

pd.date_range(start='2017-06-01 00:00:00+02:00',
              end='2017-08-01 00:00:00+02:00',
              freq='15min',
              tz='Europe/Berlin')
AssertionError: Inferred time zone not equal to passed time zone

Problem description

The given times are valid times in the Europe/Berlin timezone. However, as can be seen when the tz parameter is not passed, pandas detects them as pytz.FixedOffset(120) and then raises an error because this is not the same as Europe/Berlin.

When giving tz-aware datetimes with different UTC offsets due to a daylight savings change (e.g. 2017-06-01 00:00:00+02:00 and 2017-12-01 00:00:00+01:00), there is a

TypeError: Start and end cannot both be tz-aware with different timezones

Expected Output

DatetimeIndex(['2017-06-01 00:00:00+02:00', '2017-06-01 00:15:00+02:00',
               '2017-06-01 00:30:00+02:00', '2017-06-01 00:45:00+02:00',
               ...
               '2017-07-31 23:30:00+02:00', '2017-07-31 23:45:00+02:00'],
              dtype='datetime64[ns, Europe/Berlin]', length=6048, freq='15T')

Output of pd.show_versions()

pd.show_versions() /home/cjk/.conda/lib/python3.6/site-packages/xarray/core/formatting.py:16: FutureWarning: The pandas.tslib module is deprecated and will be removed in a future version. from pandas.tslib import OutOfBoundsDatetime INSTALLED VERSIONS ------------------ commit: None python: 3.6.1.final.0 python-bits: 64 OS: Linux OS-release: 4.10.0-27-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 pandas: 0.20.1 pytest: 3.0.7 pip: 9.0.1 setuptools: 27.2.0 Cython: 0.25.2 numpy: 1.12.1 scipy: 0.19.0 xarray: 0.9.2 IPython: 5.3.0 sphinx: 1.5.6 patsy: 0.4.1 dateutil: 2.6.0 pytz: 2017.2 blosc: None bottleneck: 1.2.1 tables: 3.3.0 numexpr: 2.6.2 feather: None matplotlib: 2.0.2 openpyxl: 2.4.7 xlrd: 1.0.0 xlwt: 1.2.0 xlsxwriter: 0.9.6 lxml: 3.7.3 bs4: 4.6.0 html5lib: 0.999 sqlalchemy: 1.1.9 pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None

Comment From: jreback

what you are doing is inherently ambiguous; these timezones are not aliases of each other, rather distinct.

In [32]: pytz.FixedOffset(120) == pytz.timezone('Europe/Berlin')
Out[32]: False

This is not a bug, rather you need to convert the tz.

e.g.

In [27]: pd.date_range(start='2017-06-01 00:00:00+02:00',
    ...:               end='2017-08-01 00:00:00+02:00',
    ...:               freq='15min').tz_convert('Europe/Berlin')
    ...:               
    ...:               
Out[27]: 
DatetimeIndex(['2017-06-01 00:00:00+02:00', '2017-06-01 00:15:00+02:00',
               '2017-06-01 00:30:00+02:00', '2017-06-01 00:45:00+02:00',
               '2017-06-01 01:00:00+02:00', '2017-06-01 01:15:00+02:00',
               '2017-06-01 01:30:00+02:00', '2017-06-01 01:45:00+02:00',
               '2017-06-01 02:00:00+02:00', '2017-06-01 02:15:00+02:00',
               ...
               '2017-07-31 21:45:00+02:00', '2017-07-31 22:00:00+02:00',
               '2017-07-31 22:15:00+02:00', '2017-07-31 22:30:00+02:00',
               '2017-07-31 22:45:00+02:00', '2017-07-31 23:00:00+02:00',
               '2017-07-31 23:15:00+02:00', '2017-07-31 23:30:00+02:00',
               '2017-07-31 23:45:00+02:00', '2017-08-01 00:00:00+02:00'],
              dtype='datetime64[ns, Europe/Berlin]', length=5857, freq='15T')