I want to add an additional column to an existing dataframe that has the length of the 'seller_name' column as its value.
The output should be like so:
seller_name name_length
-------------|-------------
Rick | 4
Hannah | 6
However, I'm having difficulty getting the code right.
df['name_length'] = len(df['seller_name'])
just gives me the length of the entire column (6845) And
df['nl'] = df[len('seller_name')]
Throws a KeyError.
Does anyone know the correct command to achieve my goal?
Many thanks!