'Cross merge on pandas dataframes

I have two dataframes one with following columns

Blue Racks
HPT
Plastic Pallet
Trolley

Just to confirm the info

and another dictionary

dd = {'Blue Racks': 6, 'HPT': 6, 'Plastic Pallet': 40, 'Trolley': 48}

When I am trying to merge them like the following:

df12 = (dfs.rename(columns=lambda x: x + '_scanned' if x in dd else x)
                .merge(pd.DataFrame(dd, index=[0]), how='cross'))

I am getting the following error:

pandas.errors.MergeError: No common columns to perform merge on. Merge options: left_on=None, right_on=None, left_index=False, right_index=False

I am unable to understand the problem here, both the dataframes have the same columns then why this error is occuring?

I printed the columns of both dataframes to confirm:

    print('dfs columns', dfs.columns)
    print('dd columns', df_dd.columns)

dfs columns Index(['Date', 'Reference Number', 'Warehouse', 'Time', 'Blue Racks', 'HPT',
       'Plastic Pallet', 'Trolley'],
      dtype='object')
dd columns Index(['Blue Racks', 'HPT', 'Plastic Pallet', 'Trolley'], dtype='object')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source