-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG/CLN: Clean float / complex string formatting #36799
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
406ed4d
a1228c9
eabef62
72be97f
e1d1ba3
d38839c
0da1c46
4ea7dcf
376b06e
473d674
e564fee
6cec317
50ccbc0
e725cb2
3a94daa
03e8cab
46949fd
11f20d0
44f0792
229b5fc
eec9d89
0e0dd92
956ecf3
25dd8f1
eca0413
00b71b2
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 |
---|---|---|
|
@@ -3432,3 +3432,10 @@ def test_format_remove_leading_space_dataframe(input_array, expected): | |
# GH: 24980 | ||
df = pd.DataFrame(input_array).to_string(index=False) | ||
assert df == expected | ||
|
||
|
||
def test_to_string_complex_number_trims_zeros(): | ||
s = pd.Series([1.000000 + 1.000000j, 1.0 + 1.0j, 1.05 + 1.0j]) | ||
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. why should these have 2 decimal zeros and not 1 likely ordinary floats? Where did you get the expected output from? 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. There's a 1.05 in the last element, the expected output is similar to what happens for floats: [ins] In [2]: s = pd.Series([1.0, 1.0000, 1.05])
[ins] In [3]: s
Out[3]:
0 1.00
1 1.00
2 1.05
dtype: float64 |
||
result = s.to_string() | ||
expected = "0 1.00+1.00j\n1 1.00+1.00j\n2 1.05+1.00j" | ||
assert result == expected |
Uh oh!
There was an error while loading. Please reload this page.