如何将功能应用于多个 pandas 数据框 [英] How to apply function to multiple pandas dataframe
本文介绍了如何将功能应用于多个 pandas 数据框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有多个数据框:
df1, df2, df3,..., dfn
它们具有相同类型的数据,但来自无法连接的不同描述符组.现在,我需要手动将相同的功能应用于每个数据框.
They have the same type of data but from different groups of descriptors that cannot be joined. Now I need to apply the same function to each dataframe manually.
如何将相同的功能应用于多个数据框?
How can I apply the same function to multiple dataframes?
推荐答案
If the data frames have the same columns you could concat
them to a single data frame, but otherwise there is not really a "smart" way of doing it:
df1, df2, df3 = (df.apply(...) for df in [df1, df2, df3]) # or either .map or .applymap
这篇关于如何将功能应用于多个 pandas 数据框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文