@@ -209,6 +209,33 @@ def test_repr_chop_threshold(self):
209
209
with option_context ("display.chop_threshold" , None ):
210
210
assert repr (df ) == ' 0 1\n 0 0.1 0.5\n 1 0.5 -0.1'
211
211
212
+ def test_repr_chop_threshold_column_below (self ):
213
+ # GH 6839: validation case
214
+
215
+ df = pd .DataFrame ([[10 , 20 , 30 , 40 ],
216
+ [8e-10 , - 1e-11 , 2e-9 , - 2e-11 ]]).T
217
+
218
+ with option_context ("display.chop_threshold" , 0 ):
219
+ assert repr (df ) == (' 0 1\n '
220
+ '0 10.0 8.000000e-10\n '
221
+ '1 20.0 -1.000000e-11\n '
222
+ '2 30.0 2.000000e-09\n '
223
+ '3 40.0 -2.000000e-11' )
224
+
225
+ with option_context ("display.chop_threshold" , 1e-8 ):
226
+ assert repr (df ) == (' 0 1\n '
227
+ '0 10.0 0.000000e+00\n '
228
+ '1 20.0 0.000000e+00\n '
229
+ '2 30.0 0.000000e+00\n '
230
+ '3 40.0 0.000000e+00' )
231
+
232
+ with option_context ("display.chop_threshold" , 5e-11 ):
233
+ assert repr (df ) == (' 0 1\n '
234
+ '0 10.0 8.000000e-10\n '
235
+ '1 20.0 0.000000e+00\n '
236
+ '2 30.0 2.000000e-09\n '
237
+ '3 40.0 0.000000e+00' )
238
+
212
239
def test_repr_obeys_max_seq_limit (self ):
213
240
with option_context ("display.max_seq_items" , 2000 ):
214
241
assert len (printing .pprint_thing (lrange (1000 ))) > 1000
0 commit comments