I have two datasets where the first dataset value is changing according to the number of objects I detected. My second dataset is a constant value where these columns should be joined with the first dataset. Now the problem is that if I have 50 rows in the first dataset and 20 rows in the second dataset. How are the remaining rows of the second dataset filled as they have a constant value?
df1 = pd.read_csv('file1.csv')
df1.head()
df2 = pd.read_csv('file2.csv)
df2.head()
Now I joined these two tables:
df_join = df1.join(df2, rsuffix='_right')
df_join.head()
how to these constant value increase based on the number of rows in df1
? Now they are NaN
. For example, the column BitSizeValue
is 8.0
, this show fill all the row of the same column.
CodePudding user response:
To fill constant
values? You mean you need to fill that Extra Nan
with constant values that are above
?
If so
df_join=df_join.fillna(method='ffill')
df_join.head()