Skip to content

TST: Iterrows making incorrect assumptions about datetime #26441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pandas/tests/frame/test_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from copy import deepcopy
import datetime
import pydoc

import numpy as np
Expand Down Expand Up @@ -222,6 +223,17 @@ def test_iterrows_iso8601(self):
exp = s.loc[k]
self._assert_series_equal(v, exp)

def test_iterrows_corner(self):
# gh-12222
df = DataFrame(
{'a': [datetime.datetime(2015, 1, 1)], 'b': [None], 'c': [None],
'd': [''], 'e': [[]], 'f': [set()], 'g': [{}]})
expected = Series(
[datetime.datetime(2015, 1, 1), None, None, '', [], set(), {}],
index=list('abcdefg'), name=0, dtype='object')
_, result = next(df.iterrows())
tm.assert_series_equal(result, expected)

def test_itertuples(self, float_frame):
for i, tup in enumerate(float_frame.itertuples()):
s = self.klass._constructor_sliced(tup[1:])
Expand Down