We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23e5f38 commit d2e2e3eCopy full SHA for d2e2e3e
pandas/tests/sparse/test_format.py
@@ -120,12 +120,11 @@ def test_sparse_frame(self):
120
def test_sparse_repr_after_set(self):
121
# GH 15488
122
sdf = pd.SparseDataFrame(index=[0, 1], columns=[0, 1])
123
+ res = sdf.copy()
124
125
# Ignore the warning
- old_opt = pd.core.config.get_option('mode.chained_assignment')
126
- pd.core.config.set_option('mode.chained_assignment', None)
127
- sdf[0][0] = 1 # This line triggers the bug
128
- try:
129
- repr(sdf)
130
- finally:
131
- pd.core.config.set_option('mode.chained_assignment', old_opt)
+ with pd.option_context('mode.chained_assignment', None):
+ sdf[0][0] = 1 # This line triggers the bug
+
+ repr(sdf)
+ tm.assert_sp_frame_equal(sdf, res)
0 commit comments