def _sanitize_column(self, key, value, **kwargs):
def sp_maker(x, index=None):<EOL><INDENT>return SparseArray(x, index=index,<EOL>fill_value=self._default_fill_value,<EOL>kind=self._default_kind)<EOL><DEDENT>if isinstance(value, SparseSeries):<EOL><INDENT>clean = value.reindex(self.index).as_sparse_array(<EOL>fill_value=self._default_fill_value, kind=self._default_kind)<EOL><DEDENT>elif isinstance(value, SparseArray):<EOL><INDENT>if len(value) != len(self.index):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>clean = value<EOL><DEDENT>elif hasattr(value, '<STR_LIT>'):<EOL><INDENT>if isinstance(value, Series):<EOL><INDENT>clean = value.reindex(self.index)<EOL>if not isinstance(value, SparseSeries):<EOL><INDENT>clean = sp_maker(clean)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if len(value) != len(self.index):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>clean = sp_maker(value)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>clean = sp_maker(value, self.index)<EOL><DEDENT>return clean<EOL>
Creates a new SparseArray from the input value.

Parameters
----------
key : object
value : scalar, Series, or array-like
kwargs : dict

Returns
-------
sanitized_column : SparseArray