Skip to content

Commit ea55a09

Browse files
committed
added test case for issue pandas-dev#43599
1 parent 0eeda64 commit ea55a09

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pandas/tests/indexing/test_loc.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from pandas.api.types import is_scalar
3939
from pandas.core.api import Float64Index
4040
from pandas.tests.indexing.common import Base
41+
import unittest
4142

4243

4344
class TestLoc(Base):
@@ -2833,7 +2834,7 @@ def test_loc_assign_dict_to_row(self, dtype):
28332834

28342835
@td.skip_array_manager_invalid_test
28352836
def test_loc_setitem_dict_timedelta_multiple_set(self):
2836-
# GH 16309
2837+
# GH 16309s
28372838
result = DataFrame(columns=["time", "value"])
28382839
result.loc[1] = {"time": Timedelta(6, unit="s"), "value": "foo"}
28392840
result.loc[1] = {"time": Timedelta(6, unit="s"), "value": "foo"}
@@ -2857,3 +2858,15 @@ def test_loc_set_multiple_items_in_multiple_new_columns(self):
28572858
)
28582859

28592860
tm.assert_frame_equal(df, expected)
2861+
2862+
2863+
class TestLoc3(unittest.TestCase): #test case for issue #43599
2864+
def test_loc_multiindex(self):
2865+
df = pd.DataFrame(index=pd.MultiIndex.from_product([list('abc'), list('de'), list('f')]), columns=['Val'])
2866+
df1=df.loc[np.s_[:,'d',:]]
2867+
df2=pd.DataFrame(index=pd.MultiIndex.from_product([list('abc'), list('d'), list('f')]), columns=['Val'])
2868+
2869+
2870+
tm.assert_frame_equal(df1,df2)
2871+
2872+

0 commit comments

Comments
 (0)