Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
def import_histo(data_histo):
dfh = pd.read_csv('Datas/' + data_histo,sep = ";", low_memory = False)
data_cols = ['var1', 'var2', 'var3', 'var4', 'var5', 'var6', 'var7', 'var8', 'var9']
dfh.reindex(data_cols, axis='columns')
dfh.set_index('var1',inplace = True)
return dfh
for file_var in file_list:
df2 = import_histo(file_var)
df = pd.concat([df,df2])
Issue Description
TypeError Traceback (most recent call last) Cell In [1], line 41 39 #description: 40 for file_var in file_list: ---> 41 df2 = import_histo(file_var) 42 df = pd.concat([df,df2]) 44 df = df.sort_values('var1', ascending = False)
Cell In [1], line 23, in import_histo(data_histo) 21 data_cols = ['var1', 'var2', 'var3', 'var4', 'var5', 'var6', 'var7', 'var8', 'var9'] 22 #dfh.reindex(data_cols, axis='columns') ---> 23 dfh = dfh.reindex(columns = data_cols) 24 #dfh.reindex() 25 dfh.set_index('annee_numero_de_tirage',inplace = True)
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/util/_decorators.py:347, in rewrite_axis_style_signature.
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/frame.py:5202, in DataFrame.reindex(self, args, kwargs) 5200 kwargs.pop("axis", None) 5201 kwargs.pop("labels", None) -> 5202 return super().reindex(*kwargs)
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/generic.py:5289, in NDFrame.reindex(self, args, *kwargs) 5286 return self._reindex_multi(axes, copy, fill_value) 5288 # perform the reindex on the axes -> 5289 return self._reindex_axes( 5290 axes, level, limit, tolerance, method, fill_value, copy 5291 ).finalize(self, method="reindex")
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/frame.py:4995, in DataFrame._reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy) 4993 columns = axes["columns"] 4994 if columns is not None: -> 4995 frame = frame._reindex_columns( 4996 columns, method, copy, level, fill_value, limit, tolerance 4997 ) 4999 index = axes["index"] 5000 if index is not None:
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/frame.py:5040, in DataFrame._reindex_columns(self, new_columns, method, copy, level, fill_value, limit, tolerance) 5027 def _reindex_columns( 5028 self, 5029 new_columns, (...) 5035 tolerance=None, 5036 ): 5037 new_columns, indexer = self.columns.reindex( 5038 new_columns, method=method, level=level, limit=limit, tolerance=tolerance 5039 ) -> 5040 return self._reindex_with_indexers( 5041 {1: [new_columns, indexer]}, 5042 copy=copy, 5043 fill_value=fill_value, 5044 allow_dups=False, 5045 )
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/generic.py:5355, in NDFrame._reindex_with_indexers(self, reindexers, fill_value, copy, allow_dups) 5352 indexer = ensure_platform_int(indexer) 5354 # TODO: speed up on homogeneous DataFrame objects (see _reindex_multi) -> 5355 new_data = new_data.reindex_indexer( 5356 index, 5357 indexer, 5358 axis=baxis, 5359 fill_value=fill_value, 5360 allow_dups=allow_dups, 5361 copy=copy, 5362 ) 5363 # If we've made a copy once, no need to make another one 5364 copy = False
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/internals/managers.py:769, in BaseBlockManager.reindex_indexer(self, new_axis, indexer, axis, fill_value, allow_dups, copy, only_slice, use_na_proxy) 766 new_axes = list(self.axes) 767 new_axes[axis] = new_axis --> 769 new_mgr = type(self).from_blocks(new_blocks, new_axes, new_refs, parent=parent) 770 if axis == 1: 771 # We can avoid the need to rebuild these 772 new_mgr._blknos = self.blknos.copy()
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/core/internals/managers.py:1075, in BlockManager.from_blocks(cls, blocks, axes, refs, parent) 1071 """ 1072 Constructor for BlockManager and SingleBlockManager with same signature. 1073 """ 1074 parent = parent if _using_copy_on_write() else None -> 1075 return cls(blocks, axes, refs, parent, verify_integrity=False)
File /private/var/containers/Bundle/Application/9181B29D-3843-4BCA-B130-BECC651D8757/Carnets.app/Library/lib/python3.11/site-packages/pandas-1.5.2-py3.11-macosx-11.5-x86_64.egg/pandas/_libs/internals.pyx:680, in pandas._libs.internals.BlockManager.cinit()
TypeError: cinit() got multiple values for keyword argument 'verify_integrity'
Expected Behavior
This code used to perfectly works on 1.3.X Pandas. It returns a Dataframe reindexed by columns. I updated the version on my tablet device and on my laptop and I now have this bug. I've found nothing on the web regarding this issue.
Installed Versions
Comment From: phofl
Hi, thanks for your report. Can you please provide a reproducible example? See https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports for an explanation
Comment From: mmmuir
I'm also getting this bug on the TestFlight version of Carnets. You should probably submit a bug report there.
By any chance are you using git to share the code between your laptop/tablet and committing pycache? If so, that could be causing the issue to propagate back to your laptop; clear it out on your laptop and try running it again.
Comment From: Trackingerror
I'm also getting this bug on the TestFlight version of Carnets. You should probably submit a bug report there.
By any chance are you using git to share the code between your laptop/tablet and committing pycache? If so, that could be causing the issue to propagate back to your laptop; clear it out on your laptop and try running it again.
Many thanks for your answer.
It seems the use of Pandas with Carnets caused the issue. There is a new release of Carnets on the app store that fixe many bugs, of which one with Pandas. Now everything is fine, Pandas is running perfectly well as it always used to :)