In pandas, I am attempting to concatenate a set of dataframes and I am getting this error:
ValueError: Plan shapes are not aligned
My understanding of .concat()
is that it will join where columns are the same, but for those that it can't find it will fill with NA. This doesn't seem to be the case here.
Here's the concat statement:
dfs = [npo_jun_df, npo_jul_df,npo_may_df,npo_apr_df,npo_feb_df]
alpha = pd.concat(dfs)
In case it helps, I have also hit this error when I tried to concatenate two data frames (and as of the time of writing this is the only related hit I can find on google other than the source code).
I don't know whether this answer would have solved the OP's problem (since he/she didn't post enough information), but for me, this was caused when I tried to concat
dataframe df1
with columns ['A', 'B', 'B', 'C']
(see the duplicate column headings?) with dataframe df2
with columns ['A', 'B']
. Understandably the duplication caused pandas to throw a wobbly. Change df1
to ['A', 'B', 'C']
(i.e. drop one of the duplicate columns) and everything works fine.