Reputation: 109
I have two data frames and I am just writing a simple pd.concat to append the data vertically:
SRC_OF_PAYMENT_80_00_CY=
pd.concat(['src_of_payment_cy','src_of_payment_df'],axis=0, ignore_index=True)
Both are dataframes types. So I don't understand the error: TypeError: cannot concatenate a non-NDFrame object
Here is the out for df.info() for both:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 10 entries, 0 to 9
Data columns (total 3 columns):
Type_of_cost 10 non-null object
Total_NHE 10 non-null float64
year 10 non-null int64
dtypes: float64(1), int64(1), object(1)
memory usage: 320.0+ bytes
src_of_payment_cy
<class 'pandas.core.frame.DataFrame'>
Int64Index: 18 entries, 9 to 26
Data columns (total 3 columns):
Type_of_cost 18 non-null object
Total_NHE 18 non-null int64
year 18 non-null int64
dtypes: int64(2), object(1)
memory usage: 576.0+ bytes
src_of_payment_df
Upvotes: 0
Views: 2066
Reputation: 3967
Remove the apostrophes around the dataframe names like -
SRC_OF_PAYMENT_80_00_CY=
pd.concat([src_of_payment_cy,src_of_payment_df],axis=0, ignore_index=True)
Upvotes: 1