@@ -286,11 +286,11 @@ def test_repr_chop_threshold_column_below(self):
286
286
)
287
287
288
288
def test_repr_obeys_max_seq_limit (self ):
289
- with option_context ("display.max_seq_items" , 2_000 ):
290
- assert len (printing .pprint_thing (list (range (1_000 )))) > 1_000
289
+ with option_context ("display.max_seq_items" , 2000 ):
290
+ assert len (printing .pprint_thing (list (range (1000 )))) > 1000
291
291
292
292
with option_context ("display.max_seq_items" , 5 ):
293
- assert len (printing .pprint_thing (list (range (1_000 )))) < 100
293
+ assert len (printing .pprint_thing (list (range (1000 )))) < 100
294
294
295
295
def test_repr_set (self ):
296
296
assert printing .pprint_thing ({1 }) == "{1}"
@@ -354,10 +354,10 @@ def test_expand_frame_repr(self):
354
354
def test_repr_non_interactive (self ):
355
355
# in non interactive mode, there can be no dependency on the
356
356
# result of terminal auto size detection
357
- df = DataFrame ("hello" , index = range (1_000 ), columns = range (5 ))
357
+ df = DataFrame ("hello" , index = range (1000 ), columns = range (5 ))
358
358
359
359
with option_context (
360
- "mode.sim_interactive" , False , "display.width" , 0 , "display.max_rows" , 5_000
360
+ "mode.sim_interactive" , False , "display.width" , 0 , "display.max_rows" , 5000
361
361
):
362
362
assert not has_truncated_repr (df )
363
363
assert not has_expanded_repr (df )
@@ -1339,7 +1339,7 @@ def test_wide_repr_wide_long_columns(self):
1339
1339
assert "ddddd" in result
1340
1340
1341
1341
def test_long_series (self ):
1342
- n = 1_000
1342
+ n = 1000
1343
1343
s = Series (
1344
1344
np .random .randint (- 50 , 50 , n ),
1345
1345
index = ["s{x:04d}" .format (x = x ) for x in range (n )],
@@ -1545,7 +1545,7 @@ def test_to_string_float_formatting(self):
1545
1545
)
1546
1546
1547
1547
df = DataFrame (
1548
- {"x" : [0 , 0.25 , 3_456 .000 , 12e45 , 1.64e6 , 1.7e8 , 1.253_456 , np .pi , - 1e6 ]}
1548
+ {"x" : [0 , 0.25 , 3456 .000 , 12e45 , 1.64e6 , 1.7e8 , 1.253_456 , np .pi , - 1e6 ]}
1549
1549
)
1550
1550
1551
1551
df_s = df .to_string ()
@@ -1566,7 +1566,7 @@ def test_to_string_float_formatting(self):
1566
1566
)
1567
1567
assert df_s == expected
1568
1568
1569
- df = DataFrame ({"x" : [3_234 , 0.253 ]})
1569
+ df = DataFrame ({"x" : [3234 , 0.253 ]})
1570
1570
df_s = df .to_string ()
1571
1571
1572
1572
expected = " x\n 0 3234.000\n 1 0.253"
@@ -1636,9 +1636,9 @@ def test_to_string_complex_float_formatting(self):
1636
1636
df = DataFrame (
1637
1637
{
1638
1638
"x" : [
1639
- (0.4_467_846_931_321_966 + 0.0_715_185_102_060_818j ),
1640
- (0.2_739_442_392_974_528 + 0.23_515_228_785_438_969j ),
1641
- (0.26_974_928_742_135_185 + 0.3_250_604_054_898_979j ),
1639
+ (0.4467846931321966 + 0.0715185102060818j ),
1640
+ (0.2739442392974528 + 0.23515228785438969j ),
1641
+ (0.26974928742135185 + 0.3250604054898979j ),
1642
1642
(- 1j ),
1643
1643
]
1644
1644
}
@@ -1690,7 +1690,7 @@ def test_to_string_index_formatter(self):
1690
1690
1691
1691
def test_to_string_left_justify_cols (self ):
1692
1692
tm .reset_display_options ()
1693
- df = DataFrame ({"x" : [3_234 , 0.253 ]})
1693
+ df = DataFrame ({"x" : [3234 , 0.253 ]})
1694
1694
df_s = df .to_string (justify = "left" )
1695
1695
expected = " x \n 0 3234.000\n 1 0.253"
1696
1696
assert df_s == expected
@@ -1699,7 +1699,7 @@ def test_to_string_format_na(self):
1699
1699
tm .reset_display_options ()
1700
1700
df = DataFrame (
1701
1701
{
1702
- "A" : [np .nan , - 1 , - 2.1_234 , 3 , 4 ],
1702
+ "A" : [np .nan , - 1 , - 2.1234 , 3 , 4 ],
1703
1703
"B" : [np .nan , "foo" , "foooo" , "fooooo" , "bar" ],
1704
1704
}
1705
1705
)
@@ -1738,7 +1738,7 @@ def test_to_string_format_inf(self):
1738
1738
tm .reset_display_options ()
1739
1739
df = DataFrame (
1740
1740
{
1741
- "A" : [- np .inf , np .inf , - 1 , - 2.1_234 , 3 , 4 ],
1741
+ "A" : [- np .inf , np .inf , - 1 , - 2.1234 , 3 , 4 ],
1742
1742
"B" : [- np .inf , np .inf , "foo" , "foooo" , "fooooo" , "bar" ],
1743
1743
}
1744
1744
)
@@ -2076,11 +2076,11 @@ def __getitem__(self, key):
2076
2076
2077
2077
def test_float_trim_zeros (self ):
2078
2078
vals = [
2079
- 2.08_430_917_305e10 ,
2080
- 3.52_205_017_305e10 ,
2081
- 2.30_674_817_305e10 ,
2082
- 2.03_954_217_305e10 ,
2083
- 5.59_897_817_305e10 ,
2079
+ 2.08430917305e10 ,
2080
+ 3.52205017305e10 ,
2081
+ 2.30674817305e10 ,
2082
+ 2.03954217305e10 ,
2083
+ 5.59897817305e10 ,
2084
2084
]
2085
2085
skip = True
2086
2086
for line in repr (DataFrame ({"A" : vals })).split ("\n " )[:- 2 ]:
@@ -2140,7 +2140,7 @@ def test_repr_unicode(self):
2140
2140
s = Series (["\u03c3 " ] * 10 )
2141
2141
repr (s )
2142
2142
2143
- a = Series (["\u05d0 " ] * 1_000 )
2143
+ a = Series (["\u05d0 " ] * 1000 )
2144
2144
a .name = "title1"
2145
2145
repr (a )
2146
2146
@@ -2202,7 +2202,7 @@ def test_to_string_mixed(self):
2202
2202
assert result == expected
2203
2203
2204
2204
def test_to_string_float_na_spacing (self ):
2205
- s = Series ([0.0 , 1.5_678 , 2.0 , - 3.0 , 4.0 ])
2205
+ s = Series ([0.0 , 1.5678 , 2.0 , - 3.0 , 4.0 ])
2206
2206
s [::2 ] = np .nan
2207
2207
2208
2208
result = s .to_string ()
@@ -2261,7 +2261,7 @@ def test_east_asian_unicode_series(self):
2261
2261
idx = pd .MultiIndex .from_tuples (
2262
2262
[("あ" , "いい" ), ("う" , "え" ), ("おおお" , "かかかか" ), ("き" , "くく" )]
2263
2263
)
2264
- s = Series ([1 , 22 , 3_333 , 44_444 ], index = idx )
2264
+ s = Series ([1 , 22 , 3333 , 44_444 ], index = idx )
2265
2265
expected = (
2266
2266
"あ いい 1\n "
2267
2267
"う え 22\n "
@@ -2271,15 +2271,15 @@ def test_east_asian_unicode_series(self):
2271
2271
assert repr (s ) == expected
2272
2272
2273
2273
# object dtype, shorter than unicode repr
2274
- s = Series ([1 , 22 , 3_333 , 44_444 ], index = [1 , "AB" , np .nan , "あああ" ])
2274
+ s = Series ([1 , 22 , 3333 , 44_444 ], index = [1 , "AB" , np .nan , "あああ" ])
2275
2275
expected = (
2276
2276
"1 1\n AB 22\n NaN 3333\n あああ 44444\n dtype: int64"
2277
2277
)
2278
2278
assert repr (s ) == expected
2279
2279
2280
2280
# object dtype, longer than unicode repr
2281
2281
s = Series (
2282
- [1 , 22 , 3_333 , 44_444 ], index = [1 , "AB" , pd .Timestamp ("2011-01-01" ), "あああ" ]
2282
+ [1 , 22 , 3333 , 44_444 ], index = [1 , "AB" , pd .Timestamp ("2011-01-01" ), "あああ" ]
2283
2283
)
2284
2284
expected = (
2285
2285
"1 1\n "
@@ -2356,7 +2356,7 @@ def test_east_asian_unicode_series(self):
2356
2356
idx = pd .MultiIndex .from_tuples (
2357
2357
[("あ" , "いい" ), ("う" , "え" ), ("おおお" , "かかかか" ), ("き" , "くく" )]
2358
2358
)
2359
- s = Series ([1 , 22 , 3_333 , 44_444 ], index = idx )
2359
+ s = Series ([1 , 22 , 3333 , 44_444 ], index = idx )
2360
2360
expected = (
2361
2361
"あ いい 1\n "
2362
2362
"う え 22\n "
@@ -2367,7 +2367,7 @@ def test_east_asian_unicode_series(self):
2367
2367
assert repr (s ) == expected
2368
2368
2369
2369
# object dtype, shorter than unicode repr
2370
- s = Series ([1 , 22 , 3_333 , 44_444 ], index = [1 , "AB" , np .nan , "あああ" ])
2370
+ s = Series ([1 , 22 , 3333 , 44_444 ], index = [1 , "AB" , np .nan , "あああ" ])
2371
2371
expected = (
2372
2372
"1 1\n AB 22\n NaN 3333\n "
2373
2373
"あああ 44444\n dtype: int64"
@@ -2376,7 +2376,7 @@ def test_east_asian_unicode_series(self):
2376
2376
2377
2377
# object dtype, longer than unicode repr
2378
2378
s = Series (
2379
- [1 , 22 , 3_333 , 44_444 ],
2379
+ [1 , 22 , 3333 , 44_444 ],
2380
2380
index = [1 , "AB" , pd .Timestamp ("2011-01-01" ), "あああ" ],
2381
2381
)
2382
2382
expected = (
@@ -2420,11 +2420,11 @@ def test_east_asian_unicode_series(self):
2420
2420
2421
2421
def test_float_trim_zeros (self ):
2422
2422
vals = [
2423
- 2.08_430_917_305e10 ,
2424
- 3.52_205_017_305e10 ,
2425
- 2.30_674_817_305e10 ,
2426
- 2.03_954_217_305e10 ,
2427
- 5.59_897_817_305e10 ,
2423
+ 2.08430917305e10 ,
2424
+ 3.52205017305e10 ,
2425
+ 2.30674817305e10 ,
2426
+ 2.03954217305e10 ,
2427
+ 5.59897817305e10 ,
2428
2428
]
2429
2429
for line in repr (Series (vals )).split ("\n " ):
2430
2430
if line .startswith ("dtype:" ):
@@ -2624,7 +2624,7 @@ def test_max_multi_index_display(self):
2624
2624
2625
2625
# Make sure #8532 is fixed
2626
2626
def test_consistent_format (self ):
2627
- s = pd .Series ([1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0.9_999 , 1 , 1 ] * 10 )
2627
+ s = pd .Series ([1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0.9999 , 1 , 1 ] * 10 )
2628
2628
with option_context ("display.max_rows" , 10 , "display.show_dimensions" , False ):
2629
2629
res = repr (s )
2630
2630
exp = (
@@ -2824,19 +2824,19 @@ def test_output_significant_digits(self):
2824
2824
"col1" : [
2825
2825
9.999e-8 ,
2826
2826
1e-7 ,
2827
- 1.0_001e -7 ,
2827
+ 1.0001e -7 ,
2828
2828
2e-7 ,
2829
2829
4.999e-7 ,
2830
2830
5e-7 ,
2831
- 5.0_001e -7 ,
2831
+ 5.0001e -7 ,
2832
2832
6e-7 ,
2833
2833
9.999e-7 ,
2834
2834
1e-6 ,
2835
- 1.0_001e -6 ,
2835
+ 1.0001e -6 ,
2836
2836
2e-6 ,
2837
2837
4.999e-6 ,
2838
2838
5e-6 ,
2839
- 5.0_001e -6 ,
2839
+ 5.0001e -6 ,
2840
2840
6e-6 ,
2841
2841
]
2842
2842
}
@@ -2891,7 +2891,7 @@ def test_too_long(self):
2891
2891
with pd .option_context ("display.precision" , 4 ):
2892
2892
# need both a number > 1e6 and something that normally formats to
2893
2893
# having length > display.precision + 6
2894
- df = pd .DataFrame (dict (x = [12_345.6_789 ]))
2894
+ df = pd .DataFrame (dict (x = [12_345.6789 ]))
2895
2895
assert str (df ) == " x\n 0 12345.6789"
2896
2896
df = pd .DataFrame (dict (x = [2e6 ]))
2897
2897
assert str (df ) == " x\n 0 2000000.0"
0 commit comments