---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [5], in <cell line: 2>()
1 # Use verify_integrity to check for duplicates
----> 2 df_concat1 = pd.concat([df1, df2], verify_integrity = True)
3 df_concat1
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/util/_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
305 if len(args) > num_allow_args:
306 warnings.warn(
307 msg.format(arguments=arguments),
308 FutureWarning,
309 stacklevel=stacklevel,
310 )
--> 311 return func(*args, **kwargs)
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/core/reshape/concat.py:347, in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
143 @deprecate_nonkeyword_arguments(version=None, allowed_args=["objs"])
144 def concat(
145 objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
(...)
154 copy: bool = True,
155 ) -> DataFrame | Series:
156 """
157 Concatenate pandas objects along a particular axis with optional set logic
158 along the other axes.
(...)
345 ValueError: Indexes have overlapping values: ['a']
346 """
--> 347 op = _Concatenator(
348 objs,
349 axis=axis,
350 ignore_index=ignore_index,
351 join=join,
352 keys=keys,
353 levels=levels,
354 names=names,
355 verify_integrity=verify_integrity,
356 copy=copy,
357 sort=sort,
358 )
360 return op.get_result()
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/core/reshape/concat.py:542, in _Concatenator.__init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
539 self.verify_integrity = verify_integrity
540 self.copy = copy
--> 542 self.new_axes = self._get_new_axes()
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/core/reshape/concat.py:612, in _Concatenator._get_new_axes(self)
610 def _get_new_axes(self) -> list[Index]:
611 ndim = self._get_result_dim()
--> 612 return [
613 self._get_concat_axis if i == self.bm_axis else self._get_comb_axis(i)
614 for i in range(ndim)
615 ]
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/core/reshape/concat.py:613, in <listcomp>(.0)
610 def _get_new_axes(self) -> list[Index]:
611 ndim = self._get_result_dim()
612 return [
--> 613 self._get_concat_axis if i == self.bm_axis else self._get_comb_axis(i)
614 for i in range(ndim)
615 ]
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/_libs/properties.pyx:37, in pandas._libs.properties.CachedProperty.__get__()
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/core/reshape/concat.py:674, in _Concatenator._get_concat_axis(self)
669 else:
670 concat_axis = _make_concat_multiindex(
671 indexes, self.keys, self.levels, self.names
672 )
--> 674 self._maybe_check_integrity(concat_axis)
676 return concat_axis
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/core/reshape/concat.py:682, in _Concatenator._maybe_check_integrity(self, concat_index)
680 if not concat_index.is_unique:
681 overlap = concat_index[concat_index.duplicated()].unique()
--> 682 raise ValueError(f"Indexes have overlapping values: {overlap}")
ValueError: Indexes have overlapping values: Int64Index([0, 1, 2, 3, 4], dtype='int64')