Skip to content

Commit d6ceeba

Browse files
committed
Merge pull request #11641 from jreback/ambig
TST: tests for outputing ambiguous times, #11619, fixed already in #11301
2 parents 52eba95 + 7d9186b commit d6ceeba

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

doc/source/whatsnew/v0.17.1.txt

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Bug Fixes
153153
- Prevent adding new attributes to the accessors ``.str``, ``.dt`` and ``.cat``. Retrieving such
154154
a value was not possible, so error out on setting it. (:issue:`10673`)
155155
- Bug in tz-conversions with an ambiguous time and ``.dt`` accessors (:issue:`11295`)
156+
- Bug in output formatting when using an index of ambiguous times (:issue:`11619`)
156157
- Bug in comparisons of Series vs list-likes (:issue:`11339`)
157158
- Bug in ``DataFrame.replace`` with a ``datetime64[ns, tz]`` and a non-compat to_replace (:issue:`11326`, :issue:`11153`)
158159
- Bug in list-like indexing with a mixed-integer Index (:issue:`11320`)

pandas/tests/test_frame.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -15449,8 +15449,8 @@ def test_to_csv_date_format(self):
1544915449
assert_frame_equal(test, nat_frame)
1545015450

1545115451
def test_to_csv_with_dst_transitions(self):
15452-
pname = '__tmp_to_csv_date_format_with_dst__'
15453-
with ensure_clean(pname) as path:
15452+
15453+
with ensure_clean('csv_date_format_with_dst') as path:
1545415454
# make sure we are not failing on transitions
1545515455
times = pd.date_range("2013-10-26 23:00", "2013-10-27 01:00",
1545615456
tz="Europe/London",
@@ -15468,6 +15468,25 @@ def test_to_csv_with_dst_transitions(self):
1546815468
result.index = pd.to_datetime(result.index).tz_localize('UTC').tz_convert('Europe/London')
1546915469
assert_frame_equal(result,df)
1547015470

15471+
# GH11619
15472+
idx = pd.date_range('2015-01-01', '2015-12-31', freq = 'H', tz='Europe/Paris')
15473+
df = DataFrame({'values' : 1, 'idx' : idx},
15474+
index=idx)
15475+
with ensure_clean('csv_date_format_with_dst') as path:
15476+
df.to_csv(path,index=True)
15477+
result = read_csv(path,index_col=0)
15478+
result.index = pd.to_datetime(result.index).tz_localize('UTC').tz_convert('Europe/Paris')
15479+
result['idx'] = pd.to_datetime(result['idx']).astype('datetime64[ns, Europe/Paris]')
15480+
assert_frame_equal(result,df)
15481+
15482+
# assert working
15483+
df.astype(str)
15484+
15485+
with ensure_clean('csv_date_format_with_dst') as path:
15486+
df.to_pickle(path)
15487+
result = pd.read_pickle(path)
15488+
assert_frame_equal(result,df)
15489+
1547115490

1547215491
def test_concat_empty_dataframe_dtypes(self):
1547315492
df = DataFrame(columns=list("abc"))

0 commit comments

Comments
 (0)