AlloViz.AlloViz.Elements.Element._check_setitem_copy¶
- Element._check_setitem_copy(t: str = 'setting', force: bool = False)¶
- Parameters:
- tstr, the type of setting error
- forcebool, default False
If True, then force showing an error.
- validate if we are doing a setitem on a chained copy.
- It is technically possible to figure out that we are setting on
- a copy even WITH a multi-dtyped pandas object. In other words, some
- blocks may be views while other are not. Currently _is_view will ALWAYS
- return False for multi-blocks to avoid having to handle this case.
- df = DataFrame(np.arange(0,9), columns=[‘count’])
- df[‘group’] = ‘b’
- # This technically need not raise SettingWithCopy if both are view
- # (which is not generally guaranteed but is usually True. However,
- # this is in general not a good practice and we recommend using .loc.
- df.iloc[0:5][‘group’] = ‘a’