File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -793,6 +793,7 @@ Other
793793
794794- Removed unused C functions from vendored UltraJSON implementation (:issue: `26198 `)
795795- Allow :class: `Index ` and :class: `RangeIndex ` to be passed to numpy ``min `` and ``max `` functions (:issue: `26125 `)
796+ - Use actual class name in repr of empty objects of a ``Series `` subclass (:issue: `27001 `).
796797
797798.. _whatsnew_0.250.contributors :
798799
Original file line number Diff line number Diff line change @@ -257,7 +257,8 @@ def to_string(self):
257257 footer = self ._get_footer ()
258258
259259 if len (series ) == 0 :
260- return 'Series([], ' + footer + ')'
260+ return "{name}([], {footer})" .format (
261+ name = self .series .__class__ .__name__ , footer = footer )
261262
262263 fmt_index , have_header = self ._get_formatted_index ()
263264 fmt_values = self ._get_formatted_values ()
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ def test_subclass_unstack(self):
3939
4040 tm .assert_frame_equal (res , exp )
4141
42+ def test_subclass_empty_repr (self ):
43+ assert 'SubclassedSeries' in repr (tm .SubclassedSeries ())
44+
4245
4346@pytest .mark .filterwarnings ("ignore:Sparse:FutureWarning" )
4447class TestSparseSeriesSubclassing :
You can’t perform that action at this time.
0 commit comments