I'm experimenting with pandas merge left_on and right_on params.
According to Documentation 1 and Documentation 2
Documentation 1: states that left_on and right_on are field names to join on in left/right DataFrame.
Documentation 2: Columns from the left DataFrame to use as keys
What does keys means?
Following documentation 1:
left_frame = pd.DataFrame({'key': range(5),
'left_value': ['a', 'b', 'c', 'd', 'e']})
right_frame = pd.DataFrame({'key': range(2,7),
'right_value': ['f', 'g', 'h', 'i', 'j']})
I did this:
df = pd.merge(left_frame,right_frame,how='right',right_on='key')
left_frame has 'key' as field name, but yet it returns
TypeError: object of type 'NoneType' has no len()
Best Answer
It seems you need:
because same left and right column names.
If columns names are different:
If check
merge
:And it means values in columns to join on.