-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Append DataFrame to Series with dateutil timezone #23685
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
Changes from all commits
850aaf9
f8cea07
36ddb68
0479c30
5d563aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1010,6 +1010,21 @@ def test_append_missing_column_proper_upcast(self, sort): | |
assert appended['A'].dtype == 'f8' | ||
assert appended['B'].dtype == 'O' | ||
|
||
def test_append_empty_frame_to_series_with_dateutil_tz(self): | ||
# GH 23682 | ||
date = Timestamp('2018-10-24 07:30:00', tz=dateutil.tz.tzutc()) | ||
s = Series({'date': date, 'a': 1.0, 'b': 2.0}) | ||
df = DataFrame(columns=['c', 'd']) | ||
result = df.append(s, ignore_index=True) | ||
expected = DataFrame([[np.nan, np.nan, 1., 2., date]], | ||
columns=['c', 'd', 'a', 'b', 'date']) | ||
# These columns get cast to object after append | ||
object_cols = ['c', 'd', 'date'] | ||
expected.loc[:, object_cols] = expected.loc[:, object_cols].astype( | ||
object | ||
) | ||
assert_frame_equal(result, expected) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mroeschke what were the expected dtypes of result and expected here? On master, everything is object, which may not have been intended. On #24024, expected has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TomAugspurger |
||
|
||
|
||
class TestConcatenate(ConcatenateBase): | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.