@@ -1770,12 +1770,14 @@ def test_east_asian_unicode_series(self):
1770
1770
name = u'おおおおおおお' )
1771
1771
1772
1772
expected = (u"0 あ\n ... \n "
1773
- u"3 ええええ\n Name: おおおおおおお, dtype: object" )
1773
+ u"3 ええええ\n "
1774
+ u"Name: おおおおおおお, Length: 4, dtype: object" )
1774
1775
self .assertEqual (_rep (s ), expected )
1775
1776
1776
1777
s .index = [u'ああ' , u'いいいい' , u'う' , u'えええ' ]
1777
1778
expected = (u"ああ あ\n ... \n "
1778
- u"えええ ええええ\n Name: おおおおおおお, dtype: object" )
1779
+ u"えええ ええええ\n "
1780
+ u"Name: おおおおおおお, Length: 4, dtype: object" )
1779
1781
self .assertEqual (_rep (s ), expected )
1780
1782
1781
1783
# Emable Unicode option -----------------------------------------
@@ -1846,14 +1848,15 @@ def test_east_asian_unicode_series(self):
1846
1848
s = Series ([u'あ' , u'いい' , u'ううう' , u'ええええ' ],
1847
1849
name = u'おおおおおおお' )
1848
1850
expected = (u"0 あ\n ... \n "
1849
- u"3 ええええ\n Name: おおおおおおお, dtype: object" )
1851
+ u"3 ええええ\n "
1852
+ u"Name: おおおおおおお, Length: 4, dtype: object" )
1850
1853
self .assertEqual (_rep (s ), expected )
1851
1854
1852
1855
s .index = [u'ああ' , u'いいいい' , u'う' , u'えええ' ]
1853
1856
expected = (u"ああ あ\n "
1854
1857
u" ... \n "
1855
1858
u"えええ ええええ\n "
1856
- u"Name: おおおおおおお, dtype: object" )
1859
+ u"Name: おおおおおおお, Length: 4, dtype: object" )
1857
1860
self .assertEqual (_rep (s ), expected )
1858
1861
1859
1862
# ambiguous unicode
@@ -2021,7 +2024,8 @@ def test_max_multi_index_display(self):
2021
2024
# Make sure #8532 is fixed
2022
2025
def test_consistent_format (self ):
2023
2026
s = pd .Series ([1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0.9999 , 1 , 1 ] * 10 )
2024
- with option_context ("display.max_rows" , 10 ):
2027
+ with option_context ("display.max_rows" , 10 ,
2028
+ "display.show_dimensions" , False ):
2025
2029
res = repr (s )
2026
2030
exp = ('0 1.0000\n 1 1.0000\n 2 1.0000\n 3 '
2027
2031
'1.0000\n 4 1.0000\n ... \n 125 '
@@ -2040,7 +2044,8 @@ def chck_ncols(self, s):
2040
2044
2041
2045
def test_format_explicit (self ):
2042
2046
test_sers = gen_series_formatting ()
2043
- with option_context ("display.max_rows" , 4 ):
2047
+ with option_context ("display.max_rows" , 4 ,
2048
+ "display.show_dimensions" , False ):
2044
2049
res = repr (test_sers ['onel' ])
2045
2050
exp = '0 a\n 1 a\n ..\n 98 a\n 99 a\n dtype: object'
2046
2051
self .assertEqual (exp , res )
@@ -2087,6 +2092,22 @@ def getndots(s):
2087
2092
strrepr = repr (s ).replace ('\n ' , '' )
2088
2093
self .assertEqual (getndots (strrepr ), 3 )
2089
2094
2095
+ def test_show_dimensions (self ):
2096
+ # gh-7117
2097
+ s = Series (range (5 ))
2098
+
2099
+ assert 'Length' not in repr (s )
2100
+
2101
+ with option_context ("display.max_rows" , 4 ):
2102
+ assert 'Length' in repr (s )
2103
+
2104
+ with option_context ("display.show_dimensions" , True ):
2105
+ assert 'Length' in repr (s )
2106
+
2107
+ with option_context ("display.max_rows" , 4 ,
2108
+ "display.show_dimensions" , False ):
2109
+ assert 'Length' not in repr (s )
2110
+
2090
2111
def test_to_string_name (self ):
2091
2112
s = Series (range (100 ), dtype = 'int64' )
2092
2113
s .name = 'myser'
0 commit comments