将两个数据帧合并为一个数据帧

时间:2016-02-08 09:04:27

标签: python numpy pandas dataframe

我有两个数据帧DATA_DF和TAUX_DF。我使用条件从TAUX_DF中选择数据并将其放入DATA_DF上的新字段中 为此,我使用DATA_DF['Taux technique']=(indexed_TAUX_DF.loc[DATA_DF['Date effet'].dt.year.where(DATA_DF['Duree (Mois)']>120),['>10 ans']]).values 我有一个result more than 10 years values

这个列包含许多纳米值。我想用另一个数据帧填充这些纳米值,这些数据帧包含另一个纳米值的值。 我用它但它不起作用DATA_DF['Taux technique'].fillna(indexed_TAUX_DF.loc[DATA_DF['Date effet'].dt.year.where(DATA_DF['Duree (Mois)']<120),['<10 ans']]) This is picture of TAUX_DF not indexed enter image description here 我有一个错误

  

ValueError:带有类&pandas.core.frame.DataFrame&#39;的无效填充值   DATA_DF [&#39; Duree(Mois)&#39;]是我使用函数获取它的期间的月数DATA_DF['Date effet'].DATA_DF['Date fin effet'].dt.month   在TAUX_DF我们有每个时期的比率例如,如果我们在2014年有不到10年的时间我们应该有结果0.34600   为此我必须选择数据,如果我们有一个不到120个月的时间,我们选择列[&#39;&lt; 10 ans&#39;]或相反,并将这些结果存储在DATA_DF的一列上[&#39; Taux技术&#39;]   当我使用indexed_TAUX_DF.loc[DATA_DF['Date effet'].dt.year.where(DATA_DF['Duree (Mois)']<120),['<10 ans']]indexed_TAUX_DF.loc[DATA_DF['Date effet'].dt.year.where(DATA_DF['Duree (Mois)']>120),['>10 ans']]时,我必须使用包含对应的纳米值的数据框for less than 10 years values

0 个答案:

没有答案
相关问题