Python 将多个数据帧合并到熊猫中时出错

Python 将多个数据帧合并到熊猫中时出错,python,pandas,data-science,typeerror,concat,Python,Pandas,Data Science,Typeerror,Concat,你好,我是一个初学者,陷入了这个奇怪的错误中 我有4个要连接的数据帧 这是我的4个DF “国家床位”、“国防床位”、“政府床位”、“保险床位” 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_

你好,我是一个初学者,陷入了这个奇怪的错误中

我有4个要连接的数据帧

这是我的4个DF
“国家床位”、“国防床位”、“政府床位”、“保险床位”

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 
主要问题是当我使用concat连接所有帧时 我试过了

我犯了一个奇怪的错误

Type Error:cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid
类型错误:无法连接类型为“”的对象;只有Series和DataFrame OBJ有效
我不知道怎么处理这件事


此外,每个DF的数据类型都是“object”,列是“float”类型

我不确定您要尝试什么。尤其是没有数据和预期产出

但是,如果您只想连接数据帧列表

df_list = [beds_mntd_bystates, beds_mntd_mod, beds_mntd_gov, beds_mntd_insure]

frame_df = pandas.concat(df_list)

请您为这些数据帧提供示例输入,以便其他人可以重现您的问题?我想您的问题是引用数据帧对象,因此将它们用作字符串。例如,使用
beds\u mntd\u bystates
代替
“beds\u mntd\u bystates”
。这就是我从错误消息中得到的。我现在已经添加了数据,看看是否可以做些什么。我认为DF的数据类型正在出错
Type Error:cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid
df_list = [beds_mntd_bystates, beds_mntd_mod, beds_mntd_gov, beds_mntd_insure]

frame_df = pandas.concat(df_list)