Save result array (rf_array
) as in the following lines: (You don't need to reshape the array)
rf_array = df_join['Prediction'].values # returns numpy.ndarray
with rasterio.open('path/to/new.tif',
'w',
driver='GTiff',
height=img.shape[0],
width=img.shape[1],
count=1,
dtype=img.dtypes[0],
crs=img.crs,
transform=img.transform) as new_file:
new_file.write(rf_array, 1)
When you open the two images in QGIS they will overlap.