Skip to content

Commit 0a9e0c6

Browse files
committed
add tz describe test for df
1 parent 3eeec04 commit 0a9e0c6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pandas/tests/frame/test_analytics.py

+21
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,27 @@ def test_describe_timedelta_values(self):
417417
"max 5 days 00:00:00 0 days 05:00:00")
418418
assert repr(res) == exp_repr
419419

420+
def test_describe_tz_values(self, tz_naive_fixture):
421+
tz = tz_naive_fixture
422+
s1 = Series(range(5))
423+
start = Timestamp(2018, 1, 1)
424+
end = Timestamp(2018, 1, 5)
425+
s2 = Series(date_range(start, end, tz=tz))
426+
df = pd.DataFrame({'s1': s1, 's2': s2})
427+
428+
expected = DataFrame({'s1': [5, np.nan, np.nan, np.nan, np.nan, np.nan,
429+
2, 1.581139, 0, 1, 2, 3, 4],
430+
's2': [5, 5, s2.value_counts().index[0], 1,
431+
start.tz_localize(tz),
432+
end.tz_localize(tz), np.nan, np.nan,
433+
np.nan, np.nan, np.nan, np.nan, np.nan]},
434+
index=['count', 'unique', 'top', 'freq', 'first',
435+
'last', 'mean', 'std', 'min', '25%', '50%',
436+
'75%', 'max']
437+
)
438+
res = df.describe(include='all')
439+
tm.assert_frame_equal(res, expected)
440+
420441
def test_reduce_mixed_frame(self):
421442
# GH 6806
422443
df = DataFrame({

0 commit comments

Comments
 (0)