File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1096,7 +1096,7 @@ def headers(self) -> Sequence[str]:
10961096
10971097 def _gen_rows_without_counts (self ) -> Iterator [Sequence [str ]]:
10981098 """Iterator with string representation of body data without counts."""
1099- yield from self ._gen_dtypes ()
1099+ yield from ([ dtype ] for dtype in self ._gen_dtypes () )
11001100
11011101 def _gen_rows_with_counts (self ) -> Iterator [Sequence [str ]]:
11021102 """Iterator with string representation of body data with counts."""
Original file line number Diff line number Diff line change @@ -190,3 +190,23 @@ def test_info_memory_usage_bug_on_multiindex():
190190 # high upper bound
191191 diff = unstacked .memory_usage (deep = True ).sum () - s .memory_usage (deep = True )
192192 assert diff < 2000
193+
194+
195+ def test_info_show_counts_false ():
196+ s = Series ([1 ])
197+ buf = StringIO ()
198+ s .info (buf = buf , show_counts = False )
199+ result = buf .getvalue ()
200+ memory_bytes = float (s .memory_usage ())
201+ expected = textwrap .dedent (
202+ f"""\
203+ <class 'pandas.Series'>
204+ RangeIndex: 1 entries, 0 to 0
205+ Series name: None
206+ Dtype
207+ -----
208+ int64
209+ dtypes: int64(1)
210+ memory usage: { memory_bytes } bytes"""
211+ )
212+ assert result .strip () == expected .strip ()
You can’t perform that action at this time.
0 commit comments