File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 6
6
import cPickle as pickle
7
7
import operator
8
8
import os
9
+ import sys
9
10
import unittest
10
11
11
12
from numpy import random , nan
@@ -1810,10 +1811,17 @@ def test_to_string_float_formatting(self):
1810
1811
1811
1812
df_s = df .to_string ()
1812
1813
1813
- expected = (' x \n 0 0.000000\n 1 0.250000\n '
1814
- '2 3456.000\n 3 1.20e+46\n 4 1.64e+06\n '
1815
- '5 1.70e+08\n 6 1.253456\n 7 3.141593\n '
1816
- '8 -1.00e+06' )
1814
+ # Python 2.5 just wants me to be sad
1815
+ if sys .version_info [0 ] == 2 and sys .version_info [1 ] < 6 :
1816
+ expected = (' x \n 0 0.0000000\n 1 0.2500000\n '
1817
+ '2 3456.0000\n 3 1.20e+046\n 4 1.64e+006\n '
1818
+ '5 1.70e+008\n 6 1.2534560\n 7 3.1415927\n '
1819
+ '8 -1.00e+006' )
1820
+ else :
1821
+ expected = (' x \n 0 0.000000\n 1 0.250000\n '
1822
+ '2 3456.000\n 3 1.20e+46\n 4 1.64e+06\n '
1823
+ '5 1.70e+08\n 6 1.253456\n 7 3.141593\n '
1824
+ '8 -1.00e+06' )
1817
1825
assert (df_s == expected )
1818
1826
1819
1827
df = DataFrame ({'x' : [3234 , 0.253 ]})
@@ -1823,6 +1831,7 @@ def test_to_string_float_formatting(self):
1823
1831
assert (df_s == expected )
1824
1832
1825
1833
com .reset_printoptions ()
1834
+ self .assertEqual (com .print_config .precision , 4 )
1826
1835
1827
1836
df = DataFrame ({'x' : [1e9 , 0.2512 ]})
1828
1837
df_s = df .to_string ()
You can’t perform that action at this time.
0 commit comments