I've extracted data via a API and the source system has created a new field. I'm trying to concatenate the 2 items below. There are more fields than this but this gets the point across. How do i merge the follow data sets?
The field names will always be the same but there might be additional columns and columns removed in the future.
Audit_ID Start Time End Time 1 02/09/2019 05:00 02/09/2019 10:45 new data
Audit_ID Start Time End Time Shift 2 03/09/2019 03:00 03/09/2019 10:45 Afters This is what i want it to look like :
Audit_ID Start Time End Time Shift 1 02/09/2019 05:00 02/09/2019 10:45 2 03/09/2019 03:00 03/09/2019 10:45 Afters When i run the code :
joined_rows = pd.concat(data1 , data2], axis=0
This gives error :
joined_rows = pd.concat([data1, data2]) AssertionError Traceback (most recent call last) <ipython-input-46-469b3f9d61b5> in <module>() ----> 1 joined_rows = pd.concat(data1 , data2], axis=0) 2 joined_rows C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\reshape\concat.py in concat(objs, axis, join, join_axes, ignore_index, keys, levels, names, verify_integrity, sort, copy) 256 ) 257 --> 258 return op.get_result() 259 260 C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\reshape\concat.py in get_result(self) 471 472 new_data = concatenate_block_managers( --> 473 mgrs_indexers, self.new_axes, concat_axis=self.axis, copy=self.copy 474 ) 475 if not self.copy: C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\managers.py in concatenate_block_managers(mgrs_indexers, axes, concat_axis, copy) 2057 blocks.append(b) 2058 -> 2059 return BlockManager(blocks, axes) C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\managers.py in __init__(self, blocks, axes, do_integrity_check) 141 142 if do_integrity_check: --> 143 self._verify_integrity() 144 145 self._consolidate_check() C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\managers.py in _verify_integrity(self) 348 "Number of manager items must equal union of " 349 "block items\n# manager items: {0}, # " --> 350 "tot_items: {1}".format(len(self.items), tot_items) 351 ) 352 AssertionError: Number of manager items must equal union of block items # manager items: 44, # tot_items: 48 Any help appreciated