File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -129,20 +129,15 @@ def assert_equal(
129129 expected = expected .replace ({None : np .nan })
130130
131131 def _to_hashable (x : t .Any ) -> t .Any :
132- return tuple (x ) if isinstance (x , list ) else x
132+ if isinstance (x , (list , np .ndarray )):
133+ return tuple (x )
134+ return str (x ) if not isinstance (x , t .Hashable ) else x
133135
134136 if sort :
135- actual = (
136- actual .apply (_to_hashable )
137- .sort_values (by = actual .columns .to_list ())
138- .reset_index (drop = True )
139- )
140- expected = (
141- expected .apply (_to_hashable )
142- .sort_values (by = expected .columns .to_list ())
143- .reset_index (drop = True )
144- )
145-
137+ actual = actual .apply (lambda col : col .map (_to_hashable ))
138+ actual = actual .sort_values (by = actual .columns .to_list ()).reset_index (drop = True )
139+ expected = expected .apply (lambda col : col .map (_to_hashable ))
140+ expected = expected .sort_values (by = expected .columns .to_list ()).reset_index (drop = True )
146141 try :
147142 pd .testing .assert_frame_equal (
148143 expected ,
You can’t perform that action at this time.
0 commit comments