@@ -204,7 +204,7 @@ def test_repr_chop_threshold(self):
204
204
self .assertEqual (repr (df ), ' 0 1\n 0 0.0 0.5\n 1 0.5 0.0' )
205
205
206
206
with option_context ("display.chop_threshold" , 0.6 ):
207
- self .assertEqual (repr (df ), ' 0 1\n 0 0 0\n 1 0 0' )
207
+ self .assertEqual (repr (df ), ' 0 1\n 0 0.0 0.0 \n 1 0.0 0. 0' )
208
208
209
209
with option_context ("display.chop_threshold" , None ):
210
210
self .assertEqual (repr (df ), ' 0 1\n 0 0.1 0.5\n 1 0.5 -0.1' )
@@ -753,7 +753,7 @@ def test_to_html_with_empty_string_label(self):
753
753
754
754
def test_to_html_unicode (self ):
755
755
df = DataFrame ({u ('\u03c3 ' ): np .arange (10. )})
756
- expected = u'<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>\u03c3 </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2</td>\n </tr>\n <tr>\n <th>3</th>\n <td>3</td>\n </tr>\n <tr>\n <th>4</th>\n <td>4</td>\n </tr>\n <tr>\n <th>5</th>\n <td>5</td>\n </tr>\n <tr>\n <th>6</th>\n <td>6</td>\n </tr>\n <tr>\n <th>7</th>\n <td>7</td>\n </tr>\n <tr>\n <th>8</th>\n <td>8</td>\n </tr>\n <tr>\n <th>9</th>\n <td>9</td>\n </tr>\n </tbody>\n </table>'
756
+ expected = u'<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>\u03c3 </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0.0 </td>\n </tr>\n <tr>\n <th>1</th>\n <td>1.0 </td>\n </tr>\n <tr>\n <th>2</th>\n <td>2.0 </td>\n </tr>\n <tr>\n <th>3</th>\n <td>3.0 </td>\n </tr>\n <tr>\n <th>4</th>\n <td>4.0 </td>\n </tr>\n <tr>\n <th>5</th>\n <td>5.0 </td>\n </tr>\n <tr>\n <th>6</th>\n <td>6.0 </td>\n </tr>\n <tr>\n <th>7</th>\n <td>7.0 </td>\n </tr>\n <tr>\n <th>8</th>\n <td>8.0 </td>\n </tr>\n <tr>\n <th>9</th>\n <td>9.0 </td>\n </tr>\n </tbody>\n </table>'
757
757
self .assertEqual (df .to_html (), expected )
758
758
df = DataFrame ({'A' : [u ('\u03c3 ' )]})
759
759
expected = u'<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>A</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>\u03c3 </td>\n </tr>\n </tbody>\n </table>'
@@ -1916,12 +1916,12 @@ def test_to_string_format_na(self):
1916
1916
'B' : [np .nan , 'foo' , 'foooo' , 'fooooo' , 'bar' ]})
1917
1917
result = df .to_string ()
1918
1918
1919
- expected = (' A B\n '
1920
- '0 NaN NaN\n '
1921
- '1 -1 foo\n '
1922
- '2 -2 foooo\n '
1923
- '3 3 fooooo\n '
1924
- '4 4 bar' )
1919
+ expected = (' A B\n '
1920
+ '0 NaN NaN\n '
1921
+ '1 -1.0 foo\n '
1922
+ '2 -2.0 foooo\n '
1923
+ '3 3.0 fooooo\n '
1924
+ '4 4.0 bar' )
1925
1925
self .assertEqual (result , expected )
1926
1926
1927
1927
def test_to_string_line_width (self ):
@@ -3760,8 +3760,8 @@ def test_misc(self):
3760
3760
def test_format (self ):
3761
3761
obj = fmt .FloatArrayFormatter (np .array ([12 , 0 ], dtype = np .float64 ))
3762
3762
result = obj .get_result ()
3763
- self .assertEqual (result [0 ], " 12" )
3764
- self .assertEqual (result [1 ], " 0" )
3763
+ self .assertEqual (result [0 ], " 12.0 " )
3764
+ self .assertEqual (result [1 ], " 0.0 " )
3765
3765
3766
3766
def test_output_significant_digits (self ):
3767
3767
# Issue #9764
@@ -3793,15 +3793,15 @@ def test_output_significant_digits(self):
3793
3793
def test_too_long (self ):
3794
3794
# GH 10451
3795
3795
with pd .option_context ('display.precision' , 4 ):
3796
- # need both a number > 1e8 and something that normally formats to
3796
+ # need both a number > 1e6 and something that normally formats to
3797
3797
# having length > display.precision + 6
3798
3798
df = pd .DataFrame (dict (x = [12345.6789 ]))
3799
3799
self .assertEqual (str (df ), ' x\n 0 12345.6789' )
3800
- df = pd .DataFrame (dict (x = [2e8 ]))
3801
- self .assertEqual (str (df ), ' x\n 0 200000000 ' )
3802
- df = pd .DataFrame (dict (x = [12345.6789 , 2e8 ]))
3800
+ df = pd .DataFrame (dict (x = [2e6 ]))
3801
+ self .assertEqual (str (df ), ' x\n 0 2000000.0 ' )
3802
+ df = pd .DataFrame (dict (x = [12345.6789 , 2e6 ]))
3803
3803
self .assertEqual (
3804
- str (df ), ' x\n 0 1.2346e+04\n 1 2.0000e+08 ' )
3804
+ str (df ), ' x\n 0 1.2346e+04\n 1 2.0000e+06 ' )
3805
3805
3806
3806
3807
3807
class TestRepr_timedelta64 (tm .TestCase ):
0 commit comments