你好,我是一个初学者,陷入了这个奇怪的错误中
我有四个要连接的数据框
这些是我有的4 DF'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'))
主要问题是当我使用concat连接所有框架时我试过
frame_df=pd.concat(frames_collection,axis=1)
我收到一个奇怪的错误
Type Error:cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid
我不知道该如何处理
每个DF的数据类型也是'object'而列也是'float'类型
我不确定您要尝试尝试什么。特别是没有数据和预期的输出。