Python 从具有1个索引的pandas输出的3个不同数据帧的追加、合并和联接问题

Python 从具有1个索引的pandas输出的3个不同数据帧的追加、合并和联接问题,python,pandas,dictionary,Python,Pandas,Dictionary,我有10000个数据,我正在将它们分类到字典中,然后使用pandas将它们导出到csv。我正在对一把钥匙的温度、压力和流量进行分类。但当我这样做时,我发现: 但我想要这样的东西: 我正在转换我的数据帧,以便索引可以是行,但在本例中,我只需要3行1、2和3,所有数据都填充这些行 flow_dictionary = {'200:P1F1':[5.5, 5.5, 5.5]} pres_dictionary = {'200:PT02':[200,200,200],

我有10000个数据,我正在将它们分类到字典中,然后使用pandas将它们导出到csv。我正在对一把钥匙的温度、压力和流量进行分类。但当我这样做时,我发现: 但我想要这样的东西:

我正在转换我的数据帧,以便索引可以是行,但在本例中,我只需要3行1、2和3,所有数据都填充这些行

flow_dictionary = {'200:P1F1':[5.5, 5.5, 5.5]}
pres_dictionary = {'200:PT02':[200,200,200],
                   '200:PT03':[200,200,200],
                   '200:PT06':[66,66,66],
                   '200:PT07':[66,66,66]}
temp_dictionary = {'200:TE02':[27,27,27], 
                   '200:TE03':[79,79,79],
                   '200:TE06':[113,113,113],
                   '200:TE07':[32,32,32]}

df = pd.DataFrame.from_dict(temp_dictionary, orient='index').T

df2 = pd.DataFrame.from_dict(pres_dictionary, orient='index').T

df3 = pd.DataFrame.from_dict(flow_dictionary, orient='index').T

df = df.append(df2, ignore_index=False, sort=True)

df = df.append(df3, ignore_index=False, sort=True)

df.to_csv('processedSegmentedData.csv')
解决方案:

df1=pd.DataFrame.from_dict(temp_dictionary,orient='index').T

df2=pd.DataFrame.from_dict(pres_dictionary,orient='index').T

df3=pd.DataFrame.from_dict(flow_dictionary,orient='index').T

df4=pd.concat([df1,df2,df3],轴=1)


df4.to_csv('processedSegmentedData.csv')

您的问题是什么?请查看并提供一份包含样本数据(以文本形式,而不是图片形式)和样本输出的报告,无样本输入和首选输出,考虑到你的能力,很难根据你想要达到的目标来测试任何解决方案inputs@G.Anderson这是怎么回事?我想我在使用concat时写的是df1而不是df4,但这对我未来的用户来说很有用:df1=pd.DataFrame.from_dict(temp_dictionary,orient='index')。T df2=pd.DataFrame.from_dict(pres_dictionary,orient='index')).T df3=pd.DataFrame.从_dict(flow_dictionary,orient='index').T df4=pd.concat([df1,df2,df3],axis=1)df4.到_csv('processedSegmentedData.csv'),您的问题是什么?请查看并提供一个包含样本数据(作为文本,而不是图片)和样本输出的示例,无需样本输入和首选输出,考虑到你的能力,很难根据你想要达到的目标来测试任何解决方案inputs@G.Anderson这是怎么回事?我想我在使用concat时写的是df1而不是df4,但这对我未来的用户来说很有用:df1=pd.DataFrame.from_dict(temp_dictionary,orient='index')。T df2=pd.DataFrame.from_dict(pres_dictionary,orient='index')).T df3=pd.DataFrame.from_dict(flow_dictionary,orient='index').T df4=pd.concat([df1,df2,df3],axis=1)df4.to_csv('processedSegmentedData.csv'))