9cc905307df8c0b6ab74b911bb0dfa3e255161fd,pandas/core/indexes/interval.py,IntervalIndex,insert,#IntervalIndex#Any#Any#,861
Before Change
left_insert, right_insert = self._data._validate_scalar(item)
new_left = self.left.insert(loc, left_insert)
new_right = self.right.insert(loc, right_insert)
result = self._data._shallow_copy(new_left, new_right)
return type(self)._simple_new(result, name=self.name)
After Change
-------
IntervalIndex
try:
result = self._data.insert(loc, item)
except (ValueError, TypeError):
// e.g trying to insert a string
dtype, _ = infer_dtype_from_scalar(item, pandas_dtype=True)
dtype = find_common_type([self.dtype, dtype])
return self.astype(dtype).insert(loc, item)
return type(self)._simple_new(result, name=self.name)
// --------------------------------------------------------------------
// Rendering Methods
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: pandas-dev/pandas
Commit Name: 9cc905307df8c0b6ab74b911bb0dfa3e255161fd
Time: 2021-03-14
Author: jbrockmendel@gmail.com
File Name: pandas/core/indexes/interval.py
Class Name: IntervalIndex
Method Name: insert
Project Name: mailgyc/doudizhu
Commit Name: 001177e85fe09a3a2fd4c30600a42b92902b3d43
Time: 2019-09-30
Author: gaoyc@outlook.com
File Name: doudizhu/apps/account/views.py
Class Name: SignupHandler
Method Name: post
Project Name: pantsbuild/pants
Commit Name: 076e01d237ab3b58cdb395fb04a7f176ab02209d
Time: 2013-10-31
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/python/python_chroot.py
Class Name: PythonChroot
Method Name: _dump_built_library