File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -731,6 +731,22 @@ def _format_duplicate_message(self) -> DataFrame:
731
731
# --------------------------------------------------------------------
732
732
# Index Internals Methods
733
733
734
+ @final
735
+ def _get_attributes_dict (self ) -> dict [str_t , Any ]:
736
+ """
737
+ Return an attributes dict for my class.
738
+
739
+ Temporarily added back for compatibility issue in dask, see
740
+ https://github.com/pandas-dev/pandas/pull/43895
741
+ """
742
+ warnings .warn (
743
+ "The Index._get_attributes_dict method is deprecated, and will be "
744
+ "removed in a future version" ,
745
+ DeprecationWarning ,
746
+ stacklevel = 2 ,
747
+ )
748
+ return {k : getattr (self , k , None ) for k in self ._attributes }
749
+
734
750
def _shallow_copy (self : _IndexT , values , name : Hashable = no_default ) -> _IndexT :
735
751
"""
736
752
Create a new Index with the same class as the caller, don't copy the
Original file line number Diff line number Diff line change @@ -1788,3 +1788,11 @@ def test_drop_duplicates_pos_args_deprecation():
1788
1788
result = idx .drop_duplicates ("last" )
1789
1789
expected = Index ([2 , 3 , 1 ])
1790
1790
tm .assert_index_equal (expected , result )
1791
+
1792
+
1793
+ def test_get_attributes_dict_deprecated ():
1794
+ # https://github.com/pandas-dev/pandas/pull/44028
1795
+ idx = Index ([1 , 2 , 3 , 1 ])
1796
+ with tm .assert_produces_warning (DeprecationWarning ):
1797
+ attrs = idx ._get_attributes_dict ()
1798
+ assert attrs == {"name" : None }
You can’t perform that action at this time.
0 commit comments