File tree 3 files changed +6
-1
lines changed
3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -793,6 +793,7 @@ Other
793
793
794
794
- Removed unused C functions from vendored UltraJSON implementation (:issue: `26198 `)
795
795
- 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 `).
796
797
797
798
.. _whatsnew_0.250.contributors :
798
799
Original file line number Diff line number Diff line change @@ -257,7 +257,8 @@ def to_string(self):
257
257
footer = self ._get_footer ()
258
258
259
259
if len (series ) == 0 :
260
- return 'Series([], ' + footer + ')'
260
+ return "{name}([], {footer})" .format (
261
+ name = self .series .__class__ .__name__ , footer = footer )
261
262
262
263
fmt_index , have_header = self ._get_formatted_index ()
263
264
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):
39
39
40
40
tm .assert_frame_equal (res , exp )
41
41
42
+ def test_subclass_empty_repr (self ):
43
+ assert 'SubclassedSeries' in repr (tm .SubclassedSeries ())
44
+
42
45
43
46
@pytest .mark .filterwarnings ("ignore:Sparse:FutureWarning" )
44
47
class TestSparseSeriesSubclassing :
You can’t perform that action at this time.
0 commit comments