This code :
import pandas as pd
data = pd.read_csv('house', sep="\t", header=None)
data.columns = ['label', 'msg']
data['msg_length'] = data['msg'].apply(lambda x: len(x))
data['msg'].hist(column =data['msg_length'], by=data['label'], bins=50)
Gives me this error:
AttributeError: 'Series' object has no attribute 'columns' `
I have tried different things with pd.DataFrame and pd.Series, without luck. What do i wrong?
Error code:



datais apd.Series, it indeed has no columns. Can you check its type - what is the result of thepd.read_csv?data.hist(column ='msg_length', by='label', bins=50)?