-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Add tests for old issues 2 #41493
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 9 commits
ed06c2b
f8b4be1
ba6907d
c7cef69
a4fd0a4
9217c43
ecd8c0e
b427b5c
239a2db
067e759
aea4e32
84327fc
415c3d0
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 |
---|---|---|
|
@@ -1750,3 +1750,23 @@ def test_readjson_bool_series(self): | |
result = read_json("[true, true, false]", typ="series") | ||
expected = Series([True, True, False]) | ||
tm.assert_series_equal(result, expected) | ||
|
||
def test_to_json_multiindex_escape(self): | ||
# GH 15273 | ||
df = DataFrame( | ||
True, | ||
index=pd.date_range("2017-01-20", "2017-01-23"), | ||
columns=["foo", "bar"], | ||
).stack() | ||
result = df.to_json() | ||
expected = ( | ||
"{\"(Timestamp('2017-01-20 00:00:00'), 'foo')\":true," | ||
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. woa, this is the 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. I believe so; yes. The result is similar to #15273 (comment) except I think it's correct that we retain the timestamp like object instead of converting to epoch timestamp |
||
"\"(Timestamp('2017-01-20 00:00:00'), 'bar')\":true," | ||
"\"(Timestamp('2017-01-21 00:00:00'), 'foo')\":true," | ||
"\"(Timestamp('2017-01-21 00:00:00'), 'bar')\":true," | ||
"\"(Timestamp('2017-01-22 00:00:00'), 'foo')\":true," | ||
"\"(Timestamp('2017-01-22 00:00:00'), 'bar')\":true," | ||
"\"(Timestamp('2017-01-23 00:00:00'), 'foo')\":true," | ||
"\"(Timestamp('2017-01-23 00:00:00'), 'bar')\":true}" | ||
) | ||
assert result == expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this expected float64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point; I think this should be
datetime64[ns]
. Opened up #41544 related to this bug.