python - Fusion Two dataframes into one dataframe -
i have 2 dataframes data_df , taux_df. use condition select data taux_df , put new field on data_df
use data_df['taux technique']=(indexed_taux_df.loc[data_df['date effet'].dt.year.where(data_df['duree (mois)']>120),['>10 ans']]).values
have result
this column contains many nan values .i want fill nan values dataframe contains values in place of nan values. use doesnt workdata_df['taux technique'].fillna(indexed_taux_df.loc[data_df['date effet'].dt.year.where(data_df['duree (mois)']<120),['<10 ans']])
this picture of taux_df not indexed have error
valueerror: invalid fill value class 'pandas.core.frame.dataframe' data_df['duree (mois)'] number of months in period use function have
data_df['date effet'].data_df['date fin effet'].dt.month
in taux_df have rate of every period example if have period less 10 years on 2014 should have result 0.34600 have select data if have period less 120 month select column ['<10 ans'] or opposite , store results on 1 column on data_df['taux technique'] when useindexed_taux_df.loc[data_df['date effet'].dt.year.where(data_df['duree (mois)']<120),['<10 ans']]
andindexed_taux_df.loc[data_df['date effet'].dt.year.where(data_df['duree (mois)']>120),['>10 ans']]
i have dataframes contains nan values opposites for less 10 years values
Comments
Post a Comment