docstr: Test that MICEData does not throw a SettingWithCopyWarning when imputing (https://github.com/statsmodels/statsmodels/issues/5430)
docstr_tok: ["Test","that","MICEData","does","not","throw","a","SettingWithCopyWarning","when","imputing","(","https",":","\/\/github.com\/statsmodels\/statsmodels\/issues\/5430",")"]
code: def test_settingwithcopywarning(self):
      "Test that MICEData does not throw a SettingWithCopyWarning when imputing (https://github.com/statsmodels/statsmodels/issues/5430)"
  
      df = gendat()
      # There need to be some ints in here for the error to be thrown
      df["intcol"] = np.arange(len(df))
      df["intcol"] = df.intcol.astype("int32")
  
      miceData = mice.MICEData(df)
  
      with pd.option_context("mode.chained_assignment", "warn"):
          with warnings.catch_warnings(record=True) as ws:
              warnings.simplefilter("always")
              miceData.update_all()
              # Only include pandas warnings. There are many from patsy
              # and sometimes warnings from other packages here
              ws = [w for w in ws if "\\pandas\\" in w.filename]
              assert len(ws) == 0
  
imports: import numpy
  import pandas
  import pytest
  from statsmodels.imputation import mice
  import statsmodels.api
  from numpy.testing import assert_equal, assert_allclose
  import warnings
label_desc: Use image node_id 2 for calling the TestMICEData obj's underlying member method code with example usage: obj.test_settingwithcopywarning() without return types