hello i am a beginner and stuck in this weird error i am getting
i have 4 dataframes which i want to concatenate
these are 4 DF i have
'beds_mntd_bystates', 'beds_mntd_mod', 'beds_mntd_gov', 'beds_mntd_insure'
every dataframe has states in it and count of total no. of hospital
and total no.of beds there the shape of each DF is also same
Total_No_of_Hospital Total_No_of_Beds
States
Andhra Pradesh 5.0 345.0
Assam 1.0 75.0
Bihar 3.0 50.0
i made them in a list using
frames_collection=[]
frames_collection.extend(values for values,name in locals().items() if values.startswith('beds_mntd'))
the main problem is when i use concat to join all frames i tried
frame_df=pd.concat(frames_collection,axis=1)
i am getting a weird error
Type Error:cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid
i dont know how to deal with this
also datatype of each of DF is 'object' and columns are 'float' type
I'm unsure about what you are trying to attempt. Especially without data and expected output.
However, if you just want to concatenate a list of data-frames;
df_list = [beds_mntd_bystates, beds_mntd_mod, beds_mntd_gov, beds_mntd_insure]
frame_df = pandas.concat(df_list)